diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-15 15:56:21 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-15 17:57:31 +0200 |
commit | 959ebbcade63423048320daaa814634c41842a36 (patch) | |
tree | fb2f8392d60cdabe6ed9b0ad47a43909b3866762 /app/services | |
parent | b73ffbd3cb7dd89f54351b74e0cf4d1df63f0310 (diff) | |
download | gitlab-ce-959ebbcade63423048320daaa814634c41842a36.tar.gz |
Clean up code around commit mentions.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/notification_service.rb | 11 | ||||
-rw-r--r-- | app/services/projects/participants_service.rb | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index cfed7964c37..1337dca8354 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -127,17 +127,12 @@ class NotificationService recipients = [] - if note.commit_id.present? - recipients << note.commit_author - end - # Add all users participating in the thread (author, assignee, comment authors) participants = - if target.respond_to?(:participants) + if target.is_a?(Commit) + target.participants(note.project) + elsif target.respond_to?(:participants) target.participants - elsif target.is_a?(Commit) - author_ids = Note.for_commit_id(target.id).pluck(:author_id).uniq - User.where(id: author_ids) else note.mentioned_users end diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb index ae6260bcdab..dcbf348153d 100644 --- a/app/services/projects/participants_service.rb +++ b/app/services/projects/participants_service.rb @@ -21,8 +21,8 @@ module Projects merge_request = project.merge_requests.find_by_iid(id) merge_request ? merge_request.participants(current_user) : [] when "Commit" - author_ids = Note.for_commit_id(id).pluck(:author_id).uniq - User.where(id: author_ids) + commit = project.repository.commit(id) + commit ? commit.participants(project, current_user) : [] else [] end |