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
extract method
ulfertsf8d349b0b693
diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rbindex ec2bbb23f4f..dbb6f9b4f6c 100644--- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb+++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb@@ -70,24 +70,28 @@ module Redmine::Acts::Journalizedenddef save_journals(force = false)- @journal_user ||= User.current- @journal_notes ||= ''+ with_ensured_journal_attributes do+ if force || JournalManager.changed?(self) || !@journal_notes.empty?+ journal = JournalManager.add_journal!(self, @journal_user, @journal_notes)- if force || JournalManager.changed?(self) || !@journal_notes.empty?- journal = JournalManager.add_journal!(self, @journal_user, @journal_notes)+ OpenProject::Notifications.send('journal_created',+ journal: journal,+ send_notification: JournalManager.send_notification)+ end- OpenProject::Notifications.send('journal_created',- journal: journal,- send_notification: JournalManager.send_notification)+ # Need to clear the notification setting after each usage otherwise it might be cached+ JournalManager.reset_notificationend+ end- # Need to clear the notification setting after each usage otherwise it might be cached- JournalManager.reset_notification+ def with_ensured_journal_attributes+ @journal_user ||= User.current+ @journal_notes ||= ''+ yield+ ensure@journal_user = nil@journal_notes = nil-- trueenddef add_journal(user = User.current, notes = '')