Skip to content

Commit

Permalink
Merge pull request #3993 from BirkbeckCTP/3992-bugfix
Browse files Browse the repository at this point in the history
Fixed an issue where bounced email notifications failed with an error due to not being linked to a journal or repository
  • Loading branch information
joemull authored Feb 28, 2024
2 parents 03bdd08 + b7f4dc6 commit ab683a0
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/utils/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,28 @@ def send_bounce_notification_to_event_actor(event):
request.site_type = target.repository
request.repository = target.repository

# Setup log dict
log_dict = {
'level': 'Info',
'action_text': 'Email Delivery Failed ',
'types': 'Email Delivery',
'target': target,
}

notify_helpers.send_email_with_body_from_setting_template(
request=request,
template='bounced_email_notification',
subject='subject_bounced_email_notification',
to=to,
context={
# currently this feature is set up for article and preprint emails.
# if no site type is set, we shouldn't try to send a bounce email.
if request.site_type:
# Setup log dict
log_dict = {
'level': 'Info',
'action_text': 'Email Delivery Failed ',
'types': 'Email Delivery',
'target': target,
'event': event,
},
log_dict=log_dict,
)
}

notify_helpers.send_email_with_body_from_setting_template(
request=request,
template='bounced_email_notification',
subject='subject_bounced_email_notification',
to=to,
context={
'target': target,
'event': event,
},
log_dict=log_dict,
)


def build_url_for_request(request=None, path="", query=None, fragment=""):
Expand Down

0 comments on commit ab683a0

Please sign in to comment.