Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
e0601537
Commit
e0601537
authored
Mar 29, 2017
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make user mentions case-insensitive
parent
ad831ace
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
changelogs/unreleased/make_user_mentions_case_insensitive.yml
...gelogs/unreleased/make_user_mentions_case_insensitive.yml
+4
-0
lib/banzai/filter/user_reference_filter.rb
lib/banzai/filter/user_reference_filter.rb
+2
-2
spec/lib/banzai/filter/user_reference_filter_spec.rb
spec/lib/banzai/filter/user_reference_filter_spec.rb
+8
-0
No files found.
changelogs/unreleased/make_user_mentions_case_insensitive.yml
0 → 100644
View file @
e0601537
---
title
:
Make user mentions case-insensitive
merge_request
:
10285
author
:
blackst0ne
lib/banzai/filter/user_reference_filter.rb
View file @
e0601537
...
...
@@ -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.
...
...
spec/lib/banzai/filter/user_reference_filter_spec.rb
View file @
e0601537
...
...
@@ -83,6 +83,14 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
expect
(
doc
.
css
(
'a'
).
length
).
to
eq
1
end
it
'links to a User with different case-sensitivity'
do
user
=
create
(
:user
,
username:
'RescueRanger'
)
doc
=
reference_filter
(
"Hey
#{
user
.
to_reference
.
upcase
}
"
)
expect
(
doc
.
css
(
'a'
).
length
).
to
eq
1
expect
(
doc
.
css
(
'a'
).
text
).
to
eq
(
user
.
to_reference
)
end
it
'includes a data-user attribute'
do
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
link
=
doc
.
css
(
'a'
).
first
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment