summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2017-03-29 08:27:05 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2017-03-29 08:27:05 +1100
commite06015379739ce6ee57318d35d18e274f4e930a6 (patch)
treee08034039b11984d692e2efbdf4675d4379c806d /lib/banzai
parentad831ace7ed8d2ed999b15f8350aaa51f0490124 (diff)
downloadgitlab-ce-e06015379739ce6ee57318d35d18e274f4e930a6.tar.gz
Make user mentions case-insensitive
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/user_reference_filter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/banzai/filter/user_reference_filter.rb b/lib/banzai/filter/user_reference_filter.rb
index fe1f0923136..a798927823f 100644
--- a/lib/banzai/filter/user_reference_filter.rb
+++ b/lib/banzai/filter/user_reference_filter.rb
@@ -60,7 +60,7 @@ module Banzai
self.class.references_in(text) do |match, username|
if username == 'all' && !skip_project_check?
link_to_all(link_content: link_content)
- elsif namespace = namespaces[username]
+ elsif namespace = namespaces[username.downcase]
link_to_namespace(namespace, link_content: link_content) || match
else
match
@@ -74,7 +74,7 @@ module Banzai
# The keys of this Hash are the namespace paths, the values the
# corresponding Namespace objects.
def namespaces
- @namespaces ||= Namespace.where_full_path_in(usernames).index_by(&:full_path)
+ @namespaces ||= Namespace.where_full_path_in(usernames).index_by(&:full_path).transform_keys(&:downcase)
end
# Returns all usernames referenced in the current document.