summaryrefslogtreecommitdiff
path: root/app/services/system_note_service.rb
diff options
context:
space:
mode:
authorRyan Scott <ryan@ryan-scott.me>2017-03-30 10:39:06 +0900
committerSean McGivern <sean@gitlab.com>2017-07-20 15:33:24 +0100
commit01c9488f4a559063eba77074ba2d369de87b8018 (patch)
treeffd18d3ebd174cf47ab9eb71cbacd940d4cf2831 /app/services/system_note_service.rb
parentb6555693a8e445405c5746b7c76c9f603395bba2 (diff)
downloadgitlab-ce-01c9488f4a559063eba77074ba2d369de87b8018.tar.gz
Added slash command to close an issue as a duplicate. Closes #26372
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r--app/services/system_note_service.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index da0f21d449a..2e5e904c43d 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -552,6 +552,25 @@ module SystemNoteService
create_note(NoteSummary.new(noteable, project, author, body, action: 'moved'))
end
+ # Called when a Notable has been marked as a duplicate of another Issue
+ #
+ # noteable - Noteable object
+ # project - Project owning noteable
+ # author - User performing the change
+ # original_issue - Issue that this is a duplicate of
+ #
+ # Example Note text:
+ #
+ # "marked this issue as a duplicate of #1234"
+ #
+ # "marked this issue as a duplicate of other_project#5678"
+ #
+ # Returns the created Note object
+ def mark_duplicate_issue(noteable, project, author, original_issue)
+ body = "marked this issue as a duplicate of #{original_issue.to_reference(project)}"
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'duplicate'))
+ end
+
private
def notes_for_mentioner(mentioner, noteable, notes)