Skip to content

Commit

Permalink
Remove send_reminder_email function from email/api
Browse files Browse the repository at this point in the history
Removes the send_reminder_email function from emails/api as the functionality is essentially duplicated in the send_cookie_email function.

Also replaces references from send_reminder_email->send_cookie_email.
  • Loading branch information
ItIsJordan committed Aug 21, 2024
1 parent 25b306b commit 3427a6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
45 changes: 0 additions & 45 deletions hepdata/modules/email/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,51 +310,6 @@ def send_cookie_email(submission_participant,
message_body,
reply_to_address=coordinator.email)

def send_reminder_email(submission_participant, record_information, version, show_detail=False, message=None):
"""
Sends an email reminder to either an uploader, or reviewer.
:param submission_participant: A SubmissionParticipant object, to receive the email reminder
:param record_information: Record object containing record information
:param version: The record version
:param show_detail: Optionally includes specific detail for each table in the submission (default is False)
:param message: Any specific message text input into the form (Default is None)
"""
site_url = current_app.config.get('SITE_URL', 'https://www.hepdata.net')
tables = []
hepsubmission = get_latest_hepsubmission(
publication_recid=record_information['recid']
)
coordinator = User.query.get(hepsubmission.coordinator)

reviewers_notified = submission_participant.user_account is not None

message_body = render_template('hepdata_theme/email/submission_status.html',
name=submission_participant.full_name,
actor=coordinator.email,
article=record_information['recid'],
message=message,
invite_token=submission_participant.invitation_cookie,
role=submission_participant.role,
show_detail=show_detail,
data_tables=tables,
reviewers_notified=reviewers_notified,
title=record_information['title'],
site_url=site_url,
reminder=True,
link=site_url + "/record/{0}"
.format(record_information['recid']))

if submission_participant.role == 'reviewer':
message_subject = '[HEPData] Reminder to review submission {0}'.format(record_information['recid'])
else:
message_subject = '[HEPData] Reminder about submission {0}'.format(record_information['recid'])

create_send_email_task(submission_participant.email,
message_subject,
message_body,
reply_to_address=coordinator.email)


def send_reserve_email(submission_participant, record_information):

Expand Down
4 changes: 2 additions & 2 deletions hepdata/modules/permissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from hepdata.ext.opensearch.admin_view.api import AdminIndexer
from hepdata.modules.dashboard.api import get_dashboard_current_user
from hepdata.modules.email.api import send_coordinator_request_mail, send_coordinator_approved_email, \
send_cookie_email, send_reserve_email, send_reminder_email
send_cookie_email, send_reserve_email
from hepdata.modules.permissions.api import get_records_participated_in_by_user, get_approved_coordinators, \
get_pending_request
from hepdata.modules.permissions.models import SubmissionParticipant, CoordinatorRequest
Expand Down Expand Up @@ -104,7 +104,7 @@ def manage_participant_status(recid, action, status_action, participant_id):
admin_idx = AdminIndexer()
admin_idx.index_submission(hepsubmission)
else:
send_reminder_email(participant, record, version=hepsubmission.version, message=request.form['review_message'])
send_cookie_email(participant, record, version=hepsubmission.version, message=request.form['review_message'])



Expand Down

0 comments on commit 3427a6d

Please sign in to comment.