Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
51ad59e0
Commit
51ad59e0
authored
Apr 21, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug causing `@whatever` inside code blocks to sometimes be picked up as a user mention.
parent
76aade28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
CHANGELOG
CHANGELOG
+2
-1
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+1
-1
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+2
-2
No files found.
CHANGELOG
View file @
51ad59e0
...
...
@@ -3,7 +3,8 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.11.0 (unreleased)
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules
-
- Fix bug causing `@whatever` inside an issue's first code block to be picked up as a user mention.
- Fix bug causing `@whatever` inside an inline code snippet (backtick-style) to be picked up as a user mention.
-
-
-
...
...
app/models/concerns/mentionable.rb
View file @
51ad59e0
...
...
@@ -28,7 +28,7 @@ def gfm_reference
# Construct a String that contains possible GFM references.
def
mentionable_text
self
.
class
.
mentionable_attrs
.
map
{
|
attr
|
send
(
attr
)
||
''
}.
join
self
.
class
.
mentionable_attrs
.
map
{
|
attr
|
send
(
attr
)
}.
compact
.
join
(
"
\n\n
"
)
end
# The GFM reference to this Mentionable, which shouldn't be included in its #references.
...
...
lib/gitlab/reference_extractor.rb
View file @
51ad59e0
...
...
@@ -18,8 +18,8 @@ def analyze(text)
text
=
text
.
dup
# Remove preformatted/code blocks so that references are not included
text
.
gsub!
(
%r{<pre>.*?</pre>|<code>.*?</code>}m
)
{
|
match
|
''
}
text
.
gsub!
(
%r{^```.*?^```}m
)
{
|
match
|
''
}
text
.
gsub!
(
/^```.*?^```/m
,
''
)
text
.
gsub!
(
/[^`]`[^`]*?`[^`]/
,
''
)
@references
=
Hash
.
new
{
|
hash
,
type
|
hash
[
type
]
=
[]
}
parse_references
(
text
)
...
...
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