diff options
author | Sean McGivern <sean@gitlab.com> | 2017-07-20 17:42:33 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-21 14:53:56 +0300 |
commit | 1df696f5a6836e03a6bf8d5139c2c7ce6d96e727 (patch) | |
tree | ecd7c4c0ad0d3233884617d1db3afacb776ad66d /app/services/system_note_service.rb | |
parent | 3498e825d08adb0311d0431d9d15e450f95bfc86 (diff) |
Move duplicate issue management to a service
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r-- | app/services/system_note_service.rb | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index ed079f0e495..2dbee9c246e 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -554,10 +554,10 @@ module SystemNoteService # Called when a Noteable 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 + # noteable - Noteable object + # project - Project owning noteable + # author - User performing the change + # canonical_issue - Issue that this is a duplicate of # # Example Note text: # @@ -566,8 +566,27 @@ module SystemNoteService # "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)}" + def mark_duplicate_issue(noteable, project, author, canonical_issue) + body = "marked this issue as a duplicate of #{canonical_issue.to_reference(project)}" + create_note(NoteSummary.new(noteable, project, author, body, action: 'duplicate')) + end + + # Called when a Noteable has been marked as the canonical Issue of a duplicate + # + # noteable - Noteable object + # project - Project owning noteable + # author - User performing the change + # duplicate_issue - Issue that was a duplicate of this + # + # Example Note text: + # + # "marked #1234 as a duplicate of this issue" + # + # "marked other_project#5678 as a duplicate of this issue" + # + # Returns the created Note object + def mark_canonical_issue_of_duplicate(noteable, project, author, duplicate_issue) + body = "marked #{duplicate_issue.to_reference(project)} as a duplicate of this issue" create_note(NoteSummary.new(noteable, project, author, body, action: 'duplicate')) end |