BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
make_user_mentions_case_insensitive.yml
...gelogs/unreleased/make_user_mentions_case_insensitive.yml
+4
-0
user_reference_filter.rb
lib/banzai/filter/user_reference_filter.rb
+2
-2
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