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

Fixed an issue where bounced email notifications failed with an error due to not being linked to a journal or repository #3993

Merged
merged 1 commit into from
Feb 28, 2024
Merged
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
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