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

shared notification url formatting #4572

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Conversation

hanars
Copy link
Collaborator

@hanars hanars commented Jan 7, 2025

email notification for RNA loading did not include the project name/URL because we were sending it with a url formatted for slack instead of regular html. Since most notification include links to projects and this is an easy mistake to make I updated the send_project_notification helper function to handle slack as well as email notification and to handle constructing the URL for each in the helper instead of having the URL passed in by the calling function. This fixes the bug and also means that this is less likely to happen again in the future. In the process of unifying the functionality there are some slight differences to some of the slack/email messages being generatdd by this helper but they should all be either improvements or at worst neutral changes

calls = []
for notif_dict in expected_notifs:
project_guid = notif_dict.get('project_guid', PROJECT_GUID)
project_name = notif_dict.get('project_name', '1kg project nåme with uniçøde')
url = f'https://test-seqr.org/project/{project_guid}/project_page'
project_link = f'<a href={url}>{project_name}</a>' if has_html else f'<{url}|{project_name}>'
project_link = f'<a href={url}>{project_name}</a>'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test change reflects the actual bug fix - we should never be sending an email with the URL formatted in anything other than html

@hanars hanars requested review from jklugherz and bpblanken January 7, 2025 22:18
users = project.subscribers.user_set.all()
notify.send(project, recipient=users, verb=notification)
notify.send(project, recipient=users, verb=f'{notification_prefix}{notification}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see notification_prefix being overridden in any calls to send_project_notification, can we remove it and make the verb f'Loaded {notification}')?

Copy link
Contributor

@jklugherz jklugherz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything else lgtm

@hanars hanars merged commit 2f7026c into dev Jan 10, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants