summaryrefslogtreecommitdiff
path: root/app/services/projects
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-17 11:03:33 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-17 11:03:33 +0200
commit630e879066156e8593a8b42b531ef727227c60bf (patch)
tree287b45affe4feb4129a10f2dbf379c3ce9c77fbf /app/services/projects
parent990b476faae2720321d9ad604fab52efc25bf82f (diff)
downloadgitlab-ce-better-commit-mentions.tar.gz
Clean up code somewhat.better-commit-mentions
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/participants_service.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb
index dcbf348153d..c2d8f48f6e4 100644
--- a/app/services/projects/participants_service.rb
+++ b/app/services/projects/participants_service.rb
@@ -13,19 +13,21 @@ module Projects
end
def participants_in(type, id)
- users = case type
- when "Issue"
- issue = project.issues.find_by_iid(id)
- issue ? issue.participants(current_user) : []
- when "MergeRequest"
- merge_request = project.merge_requests.find_by_iid(id)
- merge_request ? merge_request.participants(current_user) : []
- when "Commit"
- commit = project.repository.commit(id)
- commit ? commit.participants(project, current_user) : []
- else
- []
- end
+ users =
+ case type
+ when "Issue"
+ issue = project.issues.find_by_iid(id)
+ issue.participants(current_user) if issue
+ when "MergeRequest"
+ merge_request = project.merge_requests.find_by_iid(id)
+ merge_request.participants(current_user) if merge_request
+ when "Commit"
+ commit = project.repository.commit(id)
+ commit.participants(project, current_user) if commit
+ end
+
+ return [] unless users
+
sorted(users)
end