Correct identation, default value if note doesn't exist.
This commit is contained in:
parent
12c3962fc0
commit
d26302215a
1 changed files with 16 additions and 14 deletions
|
@ -126,10 +126,10 @@ class ProjectsController < ApplicationController
|
||||||
note_type = params['type']
|
note_type = params['type']
|
||||||
note_id = params['type_id']
|
note_id = params['type_id']
|
||||||
participating = if note_type && note_id
|
participating = if note_type && note_id
|
||||||
participants_in(note_type, note_id)
|
participants_in(note_type, note_id)
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
team_members = sorted(@project.team.members)
|
team_members = sorted(@project.team.members)
|
||||||
participants = team_members + participating
|
participants = team_members + participating
|
||||||
@suggestions = {
|
@suggestions = {
|
||||||
|
@ -174,16 +174,18 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
def participants_in(type, id)
|
def participants_in(type, id)
|
||||||
users = case type
|
users = case type
|
||||||
when "Issue"
|
when "Issue"
|
||||||
@project.issues.find_by_iid(id).participants
|
issue = @project.issues.find_by_iid(id)
|
||||||
when "MergeRequest"
|
issue ? issue.participants : []
|
||||||
@project.merge_requests.find_by_iid(id).participants
|
when "MergeRequest"
|
||||||
when "Commit"
|
merge_request = @project.merge_requests.find_by_iid(id)
|
||||||
author_ids = Note.for_commit_id(id).pluck(:author_id).uniq
|
merge_request ? merge_request.participants : []
|
||||||
User.where(id: author_ids)
|
when "Commit"
|
||||||
else
|
author_ids = Note.for_commit_id(id).pluck(:author_id).uniq
|
||||||
[]
|
User.where(id: author_ids)
|
||||||
end
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
sorted(users)
|
sorted(users)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue