Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-26 04:26:43 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-04-26 04:26:43 +0300
commita64b5e3c60ab1fe295a397422750e026c35aae97 (patch)
tree6f2539497263e9b4767506cdb3c61d36e789bdaf
parent92783eae2be4bc9305759a57f2f4f17d7705f18d (diff)
Convert UserReferenceFilter#link_to_group to use a guard clause
-rw-r--r--lib/gitlab/markdown/user_reference_filter.rb12
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)