Commit e3e41e2c authored by Kerri Miller's avatar Kerri Miller

Extract #notify_if_mentions_added method

parent 0d93f8a8
......@@ -61,16 +61,7 @@ module MergeRequests
track_title_and_desc_edits(changed_fields)
notify_if_labels_added(merge_request, old_labels)
added_mentions = merge_request.mentioned_users(current_user) - old_mentioned_users
if added_mentions.present?
notification_service.async.new_mentions_in_merge_request(
merge_request,
added_mentions,
current_user
)
end
notify_if_mentions_added(merge_request, old_mentioned_users)
# Since #mark_as_unchecked triggers an update action through the MR's
# state machine, we want to push this as far down in the process so we
......@@ -129,6 +120,18 @@ module MergeRequests
)
end
def notify_if_mentions_added(merge_request, old_mentioned_users)
added_mentions = merge_request.mentioned_users(current_user) - old_mentioned_users
return unless added_mentions.present?
notification_service.async.new_mentions_in_merge_request(
merge_request,
added_mentions,
current_user
)
end
def handle_draft_status_change(merge_request, changed_fields)
return unless changed_fields.include?("title")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment