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
dd7449b9
Commit
dd7449b9
authored
Jun 01, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-emails-are-not-user-references' into 'master'
Don't match email addresses or foo@bar as user references See merge request !11837
parents
69e31003
371ae05c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
user.rb
app/models/user.rb
+1
-0
dm-emails-are-not-user-references.yml
changelogs/unreleased/dm-emails-are-not-user-references.yml
+4
-0
user_reference_filter_spec.rb
spec/lib/banzai/filter/user_reference_filter_spec.rb
+5
-0
No files found.
app/models/user.rb
View file @
dd7449b9
...
...
@@ -369,6 +369,7 @@ class User < ActiveRecord::Base
# Pattern used to extract `@user` user references from text
def
reference_pattern
%r{
(?<!
\w
)
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<user>
#{
Gitlab
::
PathRegex
::
FULL_NAMESPACE_FORMAT_REGEX
}
)
}x
...
...
changelogs/unreleased/dm-emails-are-not-user-references.yml
0 → 100644
View file @
dd7449b9
---
title
:
Don't match email addresses or foo@bar as user references
merge_request
:
author
:
spec/lib/banzai/filter/user_reference_filter_spec.rb
View file @
dd7449b9
...
...
@@ -16,6 +16,11 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
expect
(
reference_filter
(
act
).
to_html
).
to
eq
(
exp
)
end
it
'ignores references with text before the @ sign'
do
exp
=
act
=
"Hey foo
#{
reference
}
"
expect
(
reference_filter
(
act
).
to_html
).
to
eq
(
exp
)
end
%w(pre code a style)
.
each
do
|
elem
|
it
"ignores valid references contained inside '
#{
elem
}
' element"
do
exp
=
act
=
"<
#{
elem
}
>Hey
#{
reference
}
</
#{
elem
}
>"
...
...
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