-
Notifications
You must be signed in to change notification settings - Fork 1
SS-964 Send email confirmation on project access #275
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
709ca1e
send email confirmation on project access
j-awada 6063f70
improve email message content
j-awada 87f0566
fix linting issue and remove dots at eol
j-awada 3e3e241
resolve linting issue: make line even shorter
j-awada 97c777d
linting fix: remove trailing whitespace
j-awada 8d9b1cb
use celery email task and add todo
j-awada ac0ec1a
fix formatting issue
j-awada f4a0ba2
Update e2e-tests.yaml
alfredeen b8c6b77
Merge branch 'develop' into SS-964-send-email-on-project-access
j-awada 8b12279
Merge branch 'develop' into SS-964-send-email-on-project-access
j-awada a006ddd
add comment about backslash
j-awada bb857d8
remove extra hash sign
j-awada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
|
|
||
| from apps.app_registry import APP_REGISTRY | ||
| from apps.models import BaseAppInstance | ||
| from common.tasks import send_email_task | ||
|
|
||
| from .exceptions import ProjectCreationException | ||
| from .forms import PublishProjectToGitHub | ||
|
|
@@ -355,6 +356,32 @@ def post(self, request, project_slug): | |
| project.authorized.add(selected_user) | ||
| assign_perm("can_view_project", selected_user, project) | ||
|
|
||
| project_uri = f"{request.get_host()}/projects/{project.slug}" | ||
| # The backslash below is used to ignore a newline | ||
| email_body = f"""\ | ||
| Hi {selected_username}, | ||
|
|
||
| {request.user.username} added you to the project {project.name} on SciLifeLab Serve (https://serve.scilifelab.se) | ||
| You can now view the project here: {project_uri} | ||
| If you have any questions get in touch with us at [email protected] | ||
|
|
||
| Thank you for signing up for our service. We are excited to have you on board! | ||
|
|
||
| Best regards, | ||
| The Data Centre team | ||
| """ | ||
|
|
||
| try: | ||
| # Notify user via email | ||
| send_email_task( | ||
| subject=f"You've been added to {project.name} on SciLifeLab Serve", | ||
| message=email_body, | ||
| recipient_list=[selected_username], | ||
| ) | ||
|
|
||
| except Exception as err: | ||
| logger.exception(f"Unable to send email to user: {str(err)}", exc_info=True) | ||
|
|
||
| log = ProjectLog( | ||
| project=project, | ||
| module="PR", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.