Correct identation, default value if note doesn't exist.

This commit is contained in:
Marin Jankovski 2014-03-25 17:25:16 +01:00
parent 12c3962fc0
commit d26302215a

View file

@ -175,9 +175,11 @@ class ProjectsController < ApplicationController
def participants_in(type, id)
users = case type
when "Issue"
@project.issues.find_by_iid(id).participants
issue = @project.issues.find_by_iid(id)
issue ? issue.participants : []
when "MergeRequest"
@project.merge_requests.find_by_iid(id).participants
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)