diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-03-25 17:25:16 +0100 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-03-25 18:53:09 +0100 |
commit | d26302215a81b3428ba121fe58be904ea1ac7b6e (patch) | |
tree | a54059486dcf1224f558a5d973ceafc420010b3f /app/controllers/projects_controller.rb | |
parent | 12c3962fc0741f4976688a9a15c5865b23414181 (diff) | |
download | gitlab-ce-d26302215a81b3428ba121fe58be904ea1ac7b6e.tar.gz |
Correct identation, default value if note doesn't exist.
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4afcedf3361..ebb8a90c630 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -126,10 +126,10 @@ class ProjectsController < ApplicationController note_type = params['type'] note_id = params['type_id'] participating = if note_type && note_id - participants_in(note_type, note_id) - else - [] - end + participants_in(note_type, note_id) + else + [] + end team_members = sorted(@project.team.members) participants = team_members + participating @suggestions = { @@ -174,16 +174,18 @@ class ProjectsController < ApplicationController def participants_in(type, id) users = case type - when "Issue" - @project.issues.find_by_iid(id).participants - when "MergeRequest" - @project.merge_requests.find_by_iid(id).participants - when "Commit" - author_ids = Note.for_commit_id(id).pluck(:author_id).uniq - User.where(id: author_ids) - else - [] - end + when "Issue" + issue = @project.issues.find_by_iid(id) + issue ? issue.participants : [] + when "MergeRequest" + merge_request = @project.merge_requests.find_by_iid(id) + merge_request ? merge_request.participants : [] + when "Commit" + author_ids = Note.for_commit_id(id).pluck(:author_id).uniq + User.where(id: author_ids) + else + [] + end sorted(users) end |