diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-15 12:26:58 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-15 12:26:58 +0300 |
commit | 95f0440a7823a927ebba1557b091c12255e49ac4 (patch) | |
tree | fa6d130f2baff18e7a70d74dafe79e20da35babe /app/models/concerns/participable.rb | |
parent | 4a5b77188ec7525d1c3a1ee925c8791f841b040c (diff) | |
parent | 123669a55107514798ba531ba3a744b3ec8503ee (diff) |
Merge branch 'master' into rs-redactor-filter
Diffstat (limited to 'app/models/concerns/participable.rb')
-rw-r--r-- | app/models/concerns/participable.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index 0888de62f0a..85367f89f4f 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -37,7 +37,7 @@ module Participable # Be aware that this method makes a lot of sql queries. # Save result into variable if you are going to reuse it inside same request - def participants(current_user = self.author, project = self.project, load_lazy_references: true) + def participants(current_user = self.author, load_lazy_references: true) participants = self.class.participant_attrs.flat_map do |attr| value = if attr.respond_to?(:call) @@ -46,16 +46,14 @@ module Participable send(attr) end - participants_for(value, current_user, project) + participants_for(value, current_user) end.compact.uniq if load_lazy_references participants = Gitlab::Markdown::ReferenceFilter::LazyReference.load(participants).uniq - if project - participants.select! do |user| - user.can?(:read_project, project) - end + participants.select! do |user| + user.can?(:read_project, project) end end @@ -64,14 +62,14 @@ module Participable private - def participants_for(value, current_user = nil, project = nil) + def participants_for(value, current_user = nil) case value when User, Gitlab::Markdown::ReferenceFilter::LazyReference [value] when Enumerable, ActiveRecord::Relation - value.flat_map { |v| participants_for(v, current_user, project) } + value.flat_map { |v| participants_for(v, current_user) } when Participable - value.participants(current_user, project, load_lazy_references: false) + value.participants(current_user, load_lazy_references: false) end end end |