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

Do not send notifications in Celery tasks if notifications are disabled #11750

Closed
giohappy opened this issue Dec 6, 2023 · 0 comments · Fixed by #11751
Closed

Do not send notifications in Celery tasks if notifications are disabled #11750

giohappy opened this issue Dec 6, 2023 · 0 comments · Fixed by #11751
Assignees
Milestone

Comments

@giohappy
Copy link
Contributor

giohappy commented Dec 6, 2023

There are two problems with the notifications in Celery tasks:

  1. send_queued_notifications doesn't check if settings.NOTIFICATION_ENABLED is True. We already have geonode.notification_helpers.has_notifications for that, and when the module is imported it also automatically imports the module. The geonode.task.tasks module should import the helper module and use the has_notifications inside the send_queued_notifications method.
  2. send_queued_notifications itself shouldn't be called if notifications are disabled. We must do this check inside the geonode.notification_helpers.has_notifications.call_celery decorator and avoid triggering the Celery task in case notifications are disabled.
@giohappy giohappy added this to the 4.2.0 milestone Dec 6, 2023
giohappy added a commit that referenced this issue Dec 6, 2023
…ions are disabled (#11751)

* Add test suite

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

---------

Co-authored-by: Giovanni Allegri <giohappy@gmail.com>
github-actions bot pushed a commit that referenced this issue Dec 6, 2023
…ions are disabled (#11751)

* Add test suite

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

---------

Co-authored-by: Giovanni Allegri <giohappy@gmail.com>
(cherry picked from commit ea71bcf)
giohappy pushed a commit that referenced this issue Dec 6, 2023
…ions are disabled (#11751) (#11759)

* Add test suite

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

* [Fixes #11750] Do not send notifications in Celery tasks if notifications are disabled

---------

Co-authored-by: Giovanni Allegri <giohappy@gmail.com>
(cherry picked from commit ea71bcf)

Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants