Commit d26302215a81b3428ba121fe58be904ea1ac7b6e
1 parent
12c3962f
Exists in
spb-stable
and in
3 other branches
Correct identation, default value if note doesn't exist.
Showing
1 changed file
with
16 additions
and
14 deletions
Show diff stats
app/controllers/projects_controller.rb
@@ -126,10 +126,10 @@ class ProjectsController < ApplicationController | @@ -126,10 +126,10 @@ class ProjectsController < ApplicationController | ||
126 | note_type = params['type'] | 126 | note_type = params['type'] |
127 | note_id = params['type_id'] | 127 | note_id = params['type_id'] |
128 | participating = if note_type && note_id | 128 | participating = if note_type && note_id |
129 | - participants_in(note_type, note_id) | ||
130 | - else | ||
131 | - [] | ||
132 | - end | 129 | + participants_in(note_type, note_id) |
130 | + else | ||
131 | + [] | ||
132 | + end | ||
133 | team_members = sorted(@project.team.members) | 133 | team_members = sorted(@project.team.members) |
134 | participants = team_members + participating | 134 | participants = team_members + participating |
135 | @suggestions = { | 135 | @suggestions = { |
@@ -174,16 +174,18 @@ class ProjectsController < ApplicationController | @@ -174,16 +174,18 @@ class ProjectsController < ApplicationController | ||
174 | 174 | ||
175 | def participants_in(type, id) | 175 | def participants_in(type, id) |
176 | users = case type | 176 | users = case type |
177 | - when "Issue" | ||
178 | - @project.issues.find_by_iid(id).participants | ||
179 | - when "MergeRequest" | ||
180 | - @project.merge_requests.find_by_iid(id).participants | ||
181 | - when "Commit" | ||
182 | - author_ids = Note.for_commit_id(id).pluck(:author_id).uniq | ||
183 | - User.where(id: author_ids) | ||
184 | - else | ||
185 | - [] | ||
186 | - end | 177 | + when "Issue" |
178 | + issue = @project.issues.find_by_iid(id) | ||
179 | + issue ? issue.participants : [] | ||
180 | + when "MergeRequest" | ||
181 | + merge_request = @project.merge_requests.find_by_iid(id) | ||
182 | + merge_request ? merge_request.participants : [] | ||
183 | + when "Commit" | ||
184 | + author_ids = Note.for_commit_id(id).pluck(:author_id).uniq | ||
185 | + User.where(id: author_ids) | ||
186 | + else | ||
187 | + [] | ||
188 | + end | ||
187 | sorted(users) | 189 | sorted(users) |
188 | end | 190 | end |
189 | 191 |