Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-15 16:56:21 +0300
committerDouwe Maan <douwe@gitlab.com>2015-04-15 18:57:31 +0300
commit959ebbcade63423048320daaa814634c41842a36 (patch)
treefb2f8392d60cdabe6ed9b0ad47a43909b3866762 /app/services
parentb73ffbd3cb7dd89f54351b74e0cf4d1df63f0310 (diff)
Clean up code around commit mentions.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notification_service.rb11
-rw-r--r--app/services/projects/participants_service.rb4
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