-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add email
notifications channel
#17914
Add email
notifications channel
#17914
Conversation
f9f8a62
to
bb776fb
Compare
It seems the generated schema name when using generics changes between different versions of Python... https://github.com/galaxyproject/galaxy/actions/runs/8596319163/job/23553029236?pr=17914 🤔
UpdateI fixed it with a workaround to not use Generics directly in the exposed API models because they will get this extremely long auto-generated name that even changes between different versions of Python... it is ugly. Still, the other result was uglier I think 😅 |
5af1dde
to
4575d1c
Compare
I'm completely puzzled by this error in unit and package tests...
I cannot see any unbalanced parenthesis in the whole file, let alone at position 434. In addition, this only fails consistently in Python 3.8 but not in Python 3.12 😵 am I missing something obvious? |
Arg, that happened to me to at one point and was a big mystery. Unfortunately I didn't remember what the problem was :( |
It might be an issue with how the generics are compiled ... |
This is what I see locally:
|
Makes sense... It seems there are differences between Python versions around them as per the first issue I encountered with the client schema generation... 😞 I'll try to dig a bit more into it. |
I think https://github.com/davelopez/galaxy/blob/4575d1c47845d5b0a23e664b8d2390794f4dda0b/lib/galaxy/schema/invocation.py#L98-L102 was the solution when I ran into it. |
Thank you so much @mvdbeek! That was it! I moved the logic to a |
2674499
to
b72abfa
Compare
I think this is finally ready for review so I updated the PR description. I will follow up with some additional changes that don't quite fit here. |
b72abfa
to
45f4a7f
Compare
lib/galaxy/config/templates/mail/notifications/message-email.html
Outdated
Show resolved
Hide resolved
lib/galaxy/config/templates/mail/notifications/message-email.html
Outdated
Show resolved
Hide resolved
lib/galaxy/config/templates/mail/notifications/message-email.txt
Outdated
Show resolved
Hide resolved
lib/galaxy/config/templates/mail/notifications/new_shared_item-email.html
Outdated
Show resolved
Hide resolved
lib/galaxy/config/templates/mail/notifications/new_shared_item-email.txt
Outdated
Show resolved
Hide resolved
lib/galaxy/config/templates/mail/notifications/message-email.html
Outdated
Show resolved
Hide resolved
Unfortunately I thought the default for columns was "non-nullable" so these columns are nullable in the database, but they will never be in the app. This change matches the type expected in the app with the real nullable state in the database.
This will still create the notifications and associations in the database on request, but will defer sending emails (or any other channel) to a different function called `dispatch_pending_notifications_via_channels`.
Is not yet deprecated in Python 3.7
External notification channels (like email) are processed in Celery tasks. When Celery is not enabled in the server, we cannot show those channels to the user and we have to indicate in the API that those will be ignored.
Co-authored-by: John Davis <[email protected]>
Workaround issues with generics auto-generated names when building the client schema.
This is useful when we know in advance the list of recipient users and that no group or roles need to be resolved. Like when we share an item with a list of users.
This commit updates the notification creation and sharing logic to include the `galaxy_url` field in the `NotificationCreateRequest` and `SharedItemNotificationFactory` classes. This field is used to generate links in the notification content and is passed as an argument when sending notifications to recipients.
Co-authored-by: John Davis <[email protected]>
2864b6c
to
0a287f2
Compare
Co-authored-by: John Davis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you!
Closes #17882
This PR adds a new
email
channel to the notifications system.Backend changes
notification
table.dispatched
column: will determine if this notification has been "dispatched" through the additional communication channels. Any existing notification will set this value to "True" so users won't get emails retroactively.galaxy_url
column: allows to build URLs from the notification channel plugins that don't have access to the web request context.dispatched
notifications and send them via all available channels. In-app notifications don't depend on this task so they will pop up in Galaxy at their due time. Other external channels, like email, will probably carry some delay depending on thedispatch_notifications_interval
configuration option.Frontend changes
Email
channel if the server "supports" it. The channels supported by the server are passed to the client via a new header namedsupported-channels
when requestingapi/notifications/preferences
./user/notifications?preferences=true
will display the preferences panel open. This makes it easier to link to the preferences from the email templates.Sample Emails
Shared Item
Direct Message
See it in action
How to test the changes?
enable_celery_tasks
is set to true in your Galaxy config.smtp_server
in your config. I used https://github.com/rnwood/smtp4dev/lib/galaxy/config/templates/mail/notifications/
by copying them and setting thetemplates_dir
accordingly.License