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
Refactor `add_jorunal` method to use keyword arguments
Klaus Zanders8380e0dcd4cf
diff --git a/app/models/changeset.rb b/app/models/changeset.rbindex 70d4c6e8d80..c5876036e31 100644--- a/app/models/changeset.rb+++ b/app/models/changeset.rb@@ -277,7 +277,7 @@ class Changeset < ApplicationRecorddef assign_openproject_user_from_comitterself.user = repository.find_committer_user(committer)- add_journal(user || User.anonymous, comments)+ add_journal(user: user || User.anonymous, notes: comments)end# TODO: refactor to a standard helper methoddiff --git a/app/services/add_work_package_note_service.rb b/app/services/add_work_package_note_service.rbindex 81b70d98a66..a30c3e839e2 100644--- a/app/services/add_work_package_note_service.rb+++ b/app/services/add_work_package_note_service.rb@@ -42,7 +42,7 @@ class AddWorkPackageNoteServicedef call(notes, send_notifications: nil)Journal::NotificationConfiguration.with send_notifications do- work_package.add_journal(user, notes)+ work_package.add_journal(user:, notes:)success, errors = validate_and_yield(work_package, user) dowork_package.save_journalsdiff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rbindex 20b35ab433b..99b289403b5 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb@@ -73,7 +73,7 @@ module Acts::Journalizedendend- def add_journal(user = User.current, notes = '')+ def add_journal(user: User.current, notes: '')self.journal_user ||= userself.journal_notes ||= notesenddiff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rbindex 9164fc00691..19be36eab17 100644--- a/spec/features/notifications/reminder_mail_spec.rb+++ b/spec/features/notifications/reminder_mail_spec.rb@@ -78,7 +78,7 @@ RSpec.describe "Reminder email sending", js: true, with_cuprite: true do</mention>NOTE- work_package.add_journal(other_user, note)+ work_package.add_journal(user: other_user, notes: note)work_package.save!watched_work_package.subject = 'New watched work package subject'diff --git a/spec/features/notifications/settings/immediate_reminder_spec.rb b/spec/features/notifications/settings/immediate_reminder_spec.rbindex 7ab37f05908..37f336f739b 100644--- a/spec/features/notifications/settings/immediate_reminder_spec.rb+++ b/spec/features/notifications/settings/immediate_reminder_spec.rb@@ -88,7 +88,7 @@ RSpec.describe "Immediate reminder settings",</mention>NOTE- work_package.add_journal(current_user, note)+ work_package.add_journal(user: current_user, notes: note)work_package.save!enddiff --git a/spec/models/work_package/work_package_acts_as_journalized_spec.rb b/spec/models/work_package/work_package_acts_as_journalized_spec.rbindex 97e76640bfd..6669e332f5e 100644--- a/spec/models/work_package/work_package_acts_as_journalized_spec.rb+++ b/spec/models/work_package/work_package_acts_as_journalized_spec.rb@@ -416,7 +416,7 @@ RSpec.describe WorkPackage docontext 'for only journal notes adding' dobefore do- work_package.add_journal(User.current, 'some notes')+ work_package.add_journal(user: User.current, notes: 'some notes')work_package.saveend@@ -428,7 +428,7 @@ RSpec.describe WorkPackage docontext 'for mixed journal notes and attribute adding' dobefore do- work_package.add_journal(User.current, 'some notes')+ work_package.add_journal(user: User.current, notes: 'some notes')work_package.subject = 'blubs'work_package.saveend@@ -494,7 +494,7 @@ RSpec.describe WorkPackage dolet(:second_notes) { 'Another comment, unrelated to the first one.' }before do- work_package.add_journal(new_author, second_notes)+ work_package.add_journal(user: new_author, notes: second_notes)work_package.save!enddiff --git a/spec/services/attachments/delete_service_integration_spec.rb b/spec/services/attachments/delete_service_integration_spec.rbindex 7cb2df58c33..92b79a481b7 100644--- a/spec/services/attachments/delete_service_integration_spec.rb+++ b/spec/services/attachments/delete_service_integration_spec.rb@@ -71,7 +71,7 @@ RSpec.describe Attachments::DeleteService, 'integration', with_settings: { journbefore do# Force to have a journal for the attachmentattachment- container.add_journal(user)+ container.add_journal(user:)container.save!call@@ -86,7 +86,7 @@ RSpec.describe Attachments::DeleteService, 'integration', with_settings: { journbefore do# Force to have a journal for the attachmentattachment- container.add_journal(user, 'Some notes')+ container.add_journal(user:, notes: 'Some notes')container.save!# have an invalid work packagediff --git a/spec/services/notifications/create_from_model_service_work_package_spec.rb b/spec/services/notifications/create_from_model_service_work_package_spec.rbindex 4a48a3573a0..0f7e9a15af5 100644--- a/spec/services/notifications/create_from_model_service_work_package_spec.rb+++ b/spec/services/notifications/create_from_model_service_work_package_spec.rb@@ -67,7 +67,7 @@ RSpec.describe Notifications::CreateFromModelService,let(:resource) { work_package }let(:journal) { work_package.journals.first }let(:journal_2_with_notes) do- work_package.add_journal author, 'something I have to say'+ work_package.add_journal user: author, notes: 'something I have to say'work_package.save(validate: false)work_package.journals.lastend@@ -1108,7 +1108,7 @@ RSpec.describe Notifications::CreateFromModelService,endexpect(call.all_results)- .to match_array([notification_group_recipient, notification_other_recipient])+ .to contain_exactly(notification_group_recipient, notification_other_recipient)endendend@@ -1117,7 +1117,7 @@ RSpec.describe Notifications::CreateFromModelService,describe 'in the journal notes' dolet(:journal) { journal_2_with_notes }let(:journal_2_with_notes) do- work_package.add_journal author, note+ work_package.add_journal user: author, notes: notework_package.save(validate: false)work_package.journals.lastend