Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor create_project, create_user, register_user #2084

Open
taylordowns2000 opened this issue May 14, 2024 · 1 comment
Open

Refactor create_project, create_user, register_user #2084

taylordowns2000 opened this issue May 14, 2024 · 1 comment
Labels
refactor Refactor of an existing part of the code base.

Comments

@taylordowns2000
Copy link
Member

There are a bunch of account-related features that need unpicking. Lightning.Projects.create_project was recently extended and now includes some emailing behaviour. Some unwanted side effects appeared, and we think that it's a good time to refactor these contexts and functions.

  • create project
  • create user
  • register user

Ideally, we'd always have the ability to create a project or create a user without sending emails. If we want to introduce more complex business logic like that introduced here we should consider a higher level function (like a service) that does a number of things.

By changing the deep create_project function like in the commit above, we risk modifying a lot of application behaviour.

@taylordowns2000
Copy link
Member Author

taylordowns2000 commented May 14, 2024

For discussion later, I spoke about this with @midigofrank and we found the spot that changed.

Before this commit, create_project only created projects. The pattern in use was:

def some_save_button do
  create_project
  send_email
end

and that's exactly what I'd like to see. In the commit above create_project got modified so that it really is create_project_and_send_email, and the other parts of the app that call create_project are now trying to send emails. (It's not many I don't think, but it's still a significant change in what that deep "crud-sounding" function does.)

image

For what it's worth, the only impacted places here are setup_utils and the load tests.

@christad92 christad92 added the refactor Refactor of an existing part of the code base. label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor of an existing part of the code base.
Projects
Status: Backlog
Development

No branches or pull requests

2 participants