Prevent rendering the link when the author has no access
This commit is contained in:
parent
7134599860
commit
f5e43f0788
1 changed files with 9 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue