summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMaurizio De Santis <desantis.maurizio@gmail.com>2018-01-08 23:16:55 +0100
committerMaurizio De Santis <desantis.maurizio@gmail.com>2018-01-09 14:35:26 +0100
commitd19b68b6edb8b3801ce5c00efe27d22ae3afd962 (patch)
tree3b3b3a4fd93e0ca413fac538ed95b9d6ee72b380 /app
parent8a7bbe1ff3a384a21a837c8db82cc7c9613e3114 (diff)
downloadgitlab-ce-d19b68b6edb8b3801ce5c00efe27d22ae3afd962.tar.gz
Update 'removed assignee' note to include old assignee reference
Diffstat (limited to 'app')
-rw-r--r--app/services/system_note_service.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 30a5aab13bf..06b23cd7076 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -68,21 +68,14 @@ module SystemNoteService
#
# Returns the created Note object
def change_issue_assignees(issue, project, author, old_assignees)
- body =
- if issue.assignees.any? && old_assignees.any?
- unassigned_users = old_assignees - issue.assignees
- added_users = issue.assignees.to_a - old_assignees
-
- text_parts = []
- text_parts << "assigned to #{added_users.map(&:to_reference).to_sentence}" if added_users.any?
- text_parts << "unassigned #{unassigned_users.map(&:to_reference).to_sentence}" if unassigned_users.any?
-
- text_parts.join(' and ')
- elsif old_assignees.any?
- "removed assignee"
- elsif issue.assignees.any?
- "assigned to #{issue.assignees.map(&:to_reference).to_sentence}"
- end
+ unassigned_users = old_assignees - issue.assignees
+ added_users = issue.assignees.to_a - old_assignees
+
+ text_parts = []
+ text_parts << "assigned to #{added_users.map(&:to_reference).to_sentence}" if added_users.any?
+ text_parts << "unassigned #{unassigned_users.map(&:to_reference).to_sentence}" if unassigned_users.any?
+
+ body = text_parts.join(' and ')
create_note(NoteSummary.new(issue, project, author, body, action: 'assignee'))
end