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
Boxiang Sun
gitlab-ce
Commits
07a88040
Commit
07a88040
authored
Apr 25, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NotificationService spec
parent
682ec038
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
lib/gitlab/markdown/reference_filter.rb
lib/gitlab/markdown/reference_filter.rb
+3
-3
lib/gitlab/markdown/user_reference_filter.rb
lib/gitlab/markdown/user_reference_filter.rb
+2
-2
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
+2
-2
No files found.
lib/gitlab/markdown/reference_filter.rb
View file @
07a88040
...
@@ -41,10 +41,10 @@ module Gitlab
...
@@ -41,10 +41,10 @@ module Gitlab
#
#
# type - Singular Symbol reference type (e.g., :issue, :user, etc.)
# type - Singular Symbol reference type (e.g., :issue, :user, etc.)
# value - Object to add
# value - Object to add
def
push_result
(
type
,
value
)
def
push_result
(
type
,
*
values
)
return
if
value
.
nil
?
return
if
value
s
.
empty
?
result
[
:references
][
type
].
push
(
value
)
result
[
:references
][
type
].
push
(
*
values
)
end
end
def
reference_class
(
type
)
def
reference_class
(
type
)
...
...
lib/gitlab/markdown/user_reference_filter.rb
View file @
07a88040
...
@@ -45,7 +45,7 @@ module Gitlab
...
@@ -45,7 +45,7 @@ module Gitlab
if
user
==
'all'
if
user
==
'all'
# FIXME (rspeicher): Law of Demeter
# FIXME (rspeicher): Law of Demeter
push_result
(
:user
,
project
.
team
.
members
.
flatten
)
push_result
(
:user
,
*
project
.
team
.
members
.
flatten
)
url
=
link_to_all
(
project
)
url
=
link_to_all
(
project
)
...
@@ -53,7 +53,7 @@ module Gitlab
...
@@ -53,7 +53,7 @@ module Gitlab
elsif
namespace
=
Namespace
.
find_by
(
path:
user
)
elsif
namespace
=
Namespace
.
find_by
(
path:
user
)
if
namespace
.
is_a?
(
Group
)
if
namespace
.
is_a?
(
Group
)
if
user_can_reference_group?
(
namespace
)
if
user_can_reference_group?
(
namespace
)
push_result
(
:user
,
namespace
.
users
)
push_result
(
:user
,
*
namespace
.
users
)
url
=
group_url
(
user
,
only_path:
context
[
:only_path
])
url
=
group_url
(
user
,
only_path:
context
[
:only_path
])
%(<a href="#{url}" class="#{klass}">@#{user}</a>)
%(<a href="#{url}" class="#{klass}">@#{user}</a>)
...
...
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
View file @
07a88040
...
@@ -38,7 +38,7 @@ module Gitlab::Markdown
...
@@ -38,7 +38,7 @@ module Gitlab::Markdown
it
'adds to the results hash'
do
it
'adds to the results hash'
do
result
=
pipeline_result
(
'Hey @all'
)
result
=
pipeline_result
(
'Hey @all'
)
expect
(
result
[
:references
][
:user
]).
to
eq
[
[
project
.
creator
]
]
expect
(
result
[
:references
][
:user
]).
to
eq
[
project
.
creator
]
end
end
end
end
...
@@ -90,7 +90,7 @@ module Gitlab::Markdown
...
@@ -90,7 +90,7 @@ module Gitlab::Markdown
it
'adds to the results hash'
do
it
'adds to the results hash'
do
result
=
pipeline_result
(
"Hey
#{
reference
}
"
,
current_user:
user
)
result
=
pipeline_result
(
"Hey
#{
reference
}
"
,
current_user:
user
)
expect
(
result
[
:references
][
:user
]).
to
eq
[
group
.
users
]
expect
(
result
[
:references
][
:user
]).
to
eq
group
.
users
end
end
end
end
...
...
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