Skip to content

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

return true to signal success

ulferts1773a89c5e32
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.rb
index ccd751837fb..ab7abbc7797 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
@@ -79,6 +79,7 @@ module Redmine::Acts::Journalized
journal: journal,
send_notification: Journal::NotificationConfiguration.active?)
+ true
end
end
end
diff --git a/spec/models/journal_manager_spec.rb b/spec/models/journal_manager_spec.rb
index 0ade34014cc..a0ec25c0353 100644
--- a/spec/models/journal_manager_spec.rb
+++ b/spec/models/journal_manager_spec.rb
@@ -160,41 +160,4 @@ describe JournalManager, type: :model do
end
end
end
-
- describe '.with_send_notifications' do
- let!(:send_notification_before) { described_class.send_notification }
- let(:proc_called_counter) { OpenStruct.new called: false, send_notifications: !send_notification_before }
- let(:proc) { Proc.new { proc_called_counter.called = true } }
-
- it 'executes the block' do
- described_class.with_send_notifications !send_notification_before, &proc
-
- expect(proc_called_counter.called)
- .to be_truthy
- end
-
- it 'uses the provided send_notifications value within the proc' do
- described_class.with_send_notifications !send_notification_before, &proc
-
- expect(proc_called_counter.send_notifications)
- .to eql !send_notification_before
- end
-
- it 'resets the send_notifications to the value before' do
- described_class.with_send_notifications !send_notification_before, &proc
-
- expect(described_class.send_notification)
- .to eql send_notification_before
- end
-
- context 'with an exception being raised within the block' do
- it 'raises the exception but always resets the notification value' do
- expect { described_class.with_send_notifications(!send_notification_before) { raise ArgumentError } }
- .to raise_error ArgumentError
-
- expect(described_class.send_notification)
- .to eql send_notification_before
- end
- end
- end
end
diff --git a/spec/services/add_work_package_note_service_spec.rb b/spec/services/add_work_package_note_service_spec.rb
index 703206af4c7..a39a68080ed 100644
--- a/spec/services/add_work_package_note_service_spec.rb
+++ b/spec/services/add_work_package_note_service_spec.rb
@@ -56,8 +56,8 @@ describe AddWorkPackageNoteService, type: :model do
let(:send_notifications) { false }
before do
- expect(JournalManager)
- .to receive(:with_send_notifications)
+ expect(Journal::NotificationConfiguration)
+ .to receive(:with)
.with(send_notifications)
.and_yield
diff --git a/spec/services/work_packages/update_service_spec.rb b/spec/services/work_packages/update_service_spec.rb
index ba6050686ec..9901900745c 100644
--- a/spec/services/work_packages/update_service_spec.rb
+++ b/spec/services/work_packages/update_service_spec.rb
@@ -87,8 +87,8 @@ describe WorkPackages::UpdateService, type: :model do
let(:send_notifications) { true }
before do
- expect(JournalManager)
- .to receive(:with_send_notifications)
+ expect(Journal::NotificationConfiguration)
+ .to receive(:with)
.with(send_notifications)
.and_yield