diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-14 17:20:11 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-14 17:20:11 +0300 |
commit | 4a5b77188ec7525d1c3a1ee925c8791f841b040c (patch) | |
tree | c691a9271c6c4229db9893c34880abfccefbe95a /app/models/concerns/participable.rb | |
parent | 61d8f9617681973f04d264762b54840d44dea02a (diff) |
Participable doesn't need to know about Mentionable
Diffstat (limited to 'app/models/concerns/participable.rb')
-rw-r--r-- | app/models/concerns/participable.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index 7a2bea567df..0888de62f0a 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -12,7 +12,7 @@ # # # ... # -# participant :author, :assignee, :mentioned_users, :notes +# participant :author, :assignee, :notes, ->(current_user) { mentioned_users(current_user) } # end # # issue = Issue.last @@ -39,12 +39,11 @@ module Participable # 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) participants = self.class.participant_attrs.flat_map do |attr| - meth = method(attr) value = - if attr == :mentioned_users - meth.call(current_user, load_lazy_references: false) + if attr.respond_to?(:call) + instance_exec(current_user, &attr) else - meth.call + send(attr) end participants_for(value, current_user, project) |