diff --git a/app/models/note.rb b/app/models/note.rb index 2ad6df85e5f..ed64a01756a 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -44,7 +44,7 @@ class Note < ApplicationRecord attr_accessor :user_visible_reference_count # Attribute used to store the attributes that have been changed by quick actions. - attr_accessor :commands_changes + attr_writer :commands_changes default_value_for :system, false @@ -576,6 +576,41 @@ def skip_notification? review.present? || !author.can_trigger_notifications? end + def commands_changes + @commands_changes&.slice( + :due_date, + :label_ids, + :remove_label_ids, + :add_label_ids, + :canonical_issue_id, + :clone_with_notes, + :confidential, + :create_merge_request, + :add_contacts, + :remove_contacts, + :assignee_ids, + :milestone_id, + :time_estimate, + :spend_time, + :discussion_locked, + :merge, + :rebase, + :wip_event, + :target_branch, + :reviewer_ids, + :health_status, + :promote_to_epic, + :weight, + :emoji_award, + :todo_event, + :subscription_event, + :state_event, + :title, + :tag_message, + :tag_name + ) + end + private # Using this method followed by a call to *save* may result in *ActiveRecord::RecordNotUnique* exception