diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-14 17:10:00 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-14 17:10:00 +0300 |
commit | 434180c7d2bc882d7922c73c57d209786d341948 (patch) | |
tree | 35a2b2f23911f371f5f1bb9194ea8e131410a616 | |
parent | 5619c7b9687edbeb07f4f383bd0bd1a1d94a1b50 (diff) | |
parent | e7eee3b720539f30bbd10c3231245f9d5bd7e30f (diff) |
Merge branch 'fix-group-mention' into 'master'
Fix mentioning of private groups.
`issue.participants` would mistakenly not send the `current_user` to `mentioned_users`, which means it would search for referenced groups and users as if the user was signed out. Since signed out users don't have access to private groups (groups without public projects) and since you can't reference a group you don't have access to (since this would leak its existence), the group reference wasn't found and the group members weren't notified.
Addresses internal issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2326.
See merge request !654
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/concerns/mentionable.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/participable.rb | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index a06509c7c79..a6f0c9cac89 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -58,6 +58,7 @@ v 7.11.0 (unreleased) - Fix automatic blocking of auto-created users from Active Directory. - Call merge request web hook for each new commits (Arthur Gautier) - Use SIGKILL by default in Sidekiq::MemoryKiller + - Fix mentioning of private groups. v 7.10.2 - Fix CI links on MR page diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index a5957391bb7..b7c39df885d 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -42,10 +42,10 @@ module Mentionable SystemNoteService.cross_reference_exists?(target, local_reference) end - def mentioned_users(current_user = nil, p = project) + def mentioned_users(current_user = nil) return [] if mentionable_text.blank? - ext = Gitlab::ReferenceExtractor.new(p, current_user) + ext = Gitlab::ReferenceExtractor.new(self.project, current_user) ext.analyze(mentionable_text) ext.users.uniq end diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index 7a5e4876ff2..a4832204f7b 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -40,7 +40,7 @@ module Participable meth = method(attr) value = - if meth.arity == 1 + if meth.arity == 1 || meth.arity == -1 meth.call(current_user) else meth.call |