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

Handle missing contact address in project_submission #2178

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions physionet-django/project/modelcomponents/unpublishedproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,29 @@ def has_wfdb(self):
"""
return self.files.has_wfdb_files(self)

@property
def editor_contact_email(self):
"""
Email address for contacting the project editor.

If a site-wide contact address is configured, that address
will be used for all projects. The string PROJECT-SLUG can be
included and will be replaced by the active project slug (for
example, PROJECT_EDITOR_EMAIL can be set to
'[email protected]', if the mail server
understands how to handle it.)

If there is no site-wide contact address, the primary email
address of the assigned editor is used.
"""
if not self.editor:
return None
elif settings.PROJECT_EDITOR_EMAIL:
return settings.PROJECT_EDITOR_EMAIL.replace('PROJECT-SLUG',
self.slug)
else:
return self.editor.email

def content_modified(self):
"""
Update the project's modification timestamp.
Expand Down
8 changes: 1 addition & 7 deletions physionet-django/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,12 +1418,6 @@ def project_submission(request, project_slug, **kwargs):
else:
edit_logs, copyedit_logs = None, None

if settings.PROJECT_EDITOR_EMAIL:
contact_email = settings.PROJECT_EDITOR_EMAIL.replace('PROJECT-SLUG',
project.slug)
else:
contact_email = project.editor.email

return render(
request,
"project/project_submission.html",
Expand All @@ -1435,7 +1429,7 @@ def project_submission(request, project_slug, **kwargs):
"edit_logs": edit_logs,
"copyedit_logs": copyedit_logs,
"awaiting_user_approval": awaiting_user_approval,
"contact_email": contact_email,
"contact_email": project.editor_contact_email,
},
)

Expand Down
Loading