diff options
author | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-09-30 11:14:42 +0200 |
---|---|---|
committer | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-10-03 12:05:55 +0200 |
commit | f5e43f0788438758e4b1404da19fb4255245aead (patch) | |
tree | fb393f259881d3770d8b2f335366aa7401c355e4 /lib/banzai/filter/user_reference_filter.rb | |
parent | 7134599860651cc0f502581c97853a26f2fb4471 (diff) | |
download | gitlab-ce-f5e43f0788438758e4b1404da19fb4255245aead.tar.gz |
Prevent rendering the link when the author has no access
Diffstat (limited to 'lib/banzai/filter/user_reference_filter.rb')
-rw-r--r-- | lib/banzai/filter/user_reference_filter.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/banzai/filter/user_reference_filter.rb b/lib/banzai/filter/user_reference_filter.rb index e1ca7f4d24b..b3c8e565c27 100644 --- a/lib/banzai/filter/user_reference_filter.rb +++ b/lib/banzai/filter/user_reference_filter.rb @@ -106,13 +106,17 @@ module Banzai project = context[:project] author = context[:author] - url = urls.namespace_project_url(project.namespace, project, - only_path: context[:only_path]) + if author && !project.team.member?(author) + '@all' + else + url = urls.namespace_project_url(project.namespace, project, + only_path: context[:only_path]) - data = data_attribute(project: project.id, author: author.try(:id)) - text = link_text || User.reference_prefix + 'all' + data = data_attribute(project: project.id, author: author.try(:id)) + text = link_text || User.reference_prefix + 'all' - link_tag(url, data, text, 'All Project and Group Members') + link_tag(url, data, text, 'All Project and Group Members') + end end def link_to_namespace(namespace, link_text: nil) |