Commit a64b5e3c authored by Robert Speicher's avatar Robert Speicher

Convert UserReferenceFilter#link_to_group to use a guard clause

parent 92783eae
Pipeline #18876 passed with stage
......@@ -80,15 +80,13 @@ module Gitlab
end
def link_to_group(group, namespace)
if user_can_reference_group?(namespace)
push_result(:user, *namespace.users)
return unless user_can_reference_group?(namespace)
url = urls.group_url(group, only_path: context[:only_path])
push_result(:user, *namespace.users)
%(<a href="#{url}" class="#{link_class}">@#{group}</a>)
else
nil
end
url = urls.group_url(group, only_path: context[:only_path])
%(<a href="#{url}" class="#{link_class}">@#{group}</a>)
end
def link_to_user(user, namespace)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment