diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-25 21:26:43 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-25 21:26:43 -0400 |
commit | a64b5e3c60ab1fe295a397422750e026c35aae97 (patch) | |
tree | 6f2539497263e9b4767506cdb3c61d36e789bdaf /lib | |
parent | 92783eae2be4bc9305759a57f2f4f17d7705f18d (diff) | |
download | gitlab-ce-a64b5e3c60ab1fe295a397422750e026c35aae97.tar.gz |
Convert UserReferenceFilter#link_to_group to use a guard clause
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown/user_reference_filter.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/markdown/user_reference_filter.rb b/lib/gitlab/markdown/user_reference_filter.rb index 9cd5245cbcd..28ec041b1d4 100644 --- a/lib/gitlab/markdown/user_reference_filter.rb +++ b/lib/gitlab/markdown/user_reference_filter.rb @@ -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) |