OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add subscribe listeners for JOURNAL_UPDATED
Oliver Günther0be915f1df3a
diff --git a/app/services/journals/update_service.rb b/app/services/journals/update_service.rbindex 229838dd8df..db3ba619ede 100644--- a/app/services/journals/update_service.rb+++ b/app/services/journals/update_service.rb@@ -27,5 +27,15 @@#++module Journals- class UpdateService < ::BaseServices::Update; end+ class UpdateService < ::BaseServices::Update+ protected++ def after_perform(call)+ OpenProject::Notifications.send(OpenProject::Events::JOURNAL_UPDATED,+ journal: call.result,+ send_notification: Journal::NotificationConfiguration.active?)++ call+ end+ endenddiff --git a/config/initializers/subscribe_listeners.rb b/config/initializers/subscribe_listeners.rbindex 6a3a1a88968..8d92ad9290e 100644--- a/config/initializers/subscribe_listeners.rb+++ b/config/initializers/subscribe_listeners.rb@@ -43,6 +43,16 @@ Rails.application.config.after_initialize doJournals::CompletedJob.schedule(payload[:journal], payload[:send_notification])end+ OpenProject::Notifications.subscribe(OpenProject::Events::JOURNAL_UPDATED) do |payload|+ # A job is scheduled immediately that creates notifications (in-app if+ # supported) right away and schedules jobs to be run for mail and digest+ # mails.+ Notifications::WorkflowJob+ .perform_later(:create_notifications,+ payload[:journal],+ payload[:send_notification])+ end+OpenProject::Notifications.subscribe(OpenProject::Events::WATCHER_ADDED) do |payload|next unless payload[:send_notifications]diff --git a/lib/open_project/events.rb b/lib/open_project/events.rbindex 367335f3dba..143cbf70163 100644--- a/lib/open_project/events.rb+++ b/lib/open_project/events.rb@@ -47,6 +47,7 @@ module OpenProjectATTACHMENT_CREATED = "attachment_created"JOURNAL_CREATED = "journal_created"+ JOURNAL_UPDATED = "journal_updated"MEMBER_CREATED = "member_created"MEMBER_UPDATED = "member_updated"