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
9910b7ff
Commit
9910b7ff
authored
Feb 04, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow groups to be mentioned.
Resolves #1673.
parent
56a456b4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
10 deletions
+25
-10
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+6
-3
app/services/projects/participants_service.rb
app/services/projects/participants_service.rb
+8
-3
doc/markdown/markdown.md
doc/markdown/markdown.md
+1
-1
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+9
-2
No files found.
app/controllers/projects_controller.rb
View file @
9910b7ff
...
@@ -102,7 +102,7 @@ class ProjectsController < ApplicationController
...
@@ -102,7 +102,7 @@ class ProjectsController < ApplicationController
note_type
=
params
[
'type'
]
note_type
=
params
[
'type'
]
note_id
=
params
[
'type_id'
]
note_id
=
params
[
'type_id'
]
autocomplete
=
::
Projects
::
AutocompleteService
.
new
(
@project
)
autocomplete
=
::
Projects
::
AutocompleteService
.
new
(
@project
)
participants
=
::
Projects
::
ParticipantsService
.
new
(
@project
).
execute
(
note_type
,
note_id
)
participants
=
::
Projects
::
ParticipantsService
.
new
(
@project
,
current_user
).
execute
(
note_type
,
note_id
)
@suggestions
=
{
@suggestions
=
{
emojis:
autocomplete_emojis
,
emojis:
autocomplete_emojis
,
...
...
app/models/concerns/mentionable.rb
View file @
9910b7ff
...
@@ -51,9 +51,12 @@ module Mentionable
...
@@ -51,9 +51,12 @@ module Mentionable
identifier
=
match
.
delete
"@"
identifier
=
match
.
delete
"@"
if
identifier
==
"all"
if
identifier
==
"all"
users
.
push
(
*
project
.
team
.
members
.
flatten
)
users
.
push
(
*
project
.
team
.
members
.
flatten
)
elsif
namespace
=
Namespace
.
find_by
(
path:
identifier
)
if
namespace
.
type
==
"Group"
users
.
push
(
*
namespace
.
users
)
else
else
id
=
User
.
find_by
(
username:
identifier
).
try
(
:id
)
users
<<
namespace
.
owner
users
<<
User
.
find
(
id
)
unless
id
.
blank?
end
end
end
end
end
users
.
uniq
users
.
uniq
...
...
app/services/projects/participants_service.rb
View file @
9910b7ff
module
Projects
module
Projects
class
ParticipantsService
<
BaseService
class
ParticipantsService
<
BaseService
def
initialize
(
project
)
def
initialize
(
project
,
user
)
@project
=
project
@project
=
project
@user
=
user
end
end
def
execute
(
note_type
,
note_id
)
def
execute
(
note_type
,
note_id
)
...
@@ -12,7 +13,7 @@ module Projects
...
@@ -12,7 +13,7 @@ module Projects
[]
[]
end
end
team_members
=
sorted
(
@project
.
team
.
members
)
team_members
=
sorted
(
@project
.
team
.
members
)
participants
=
all_members
+
team_members
+
participating
participants
=
all_members
+
groups
+
team_members
+
participating
participants
.
uniq
participants
.
uniq
end
end
...
@@ -37,6 +38,10 @@ module Projects
...
@@ -37,6 +38,10 @@ module Projects
users
.
uniq
.
to_a
.
compact
.
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
users
.
uniq
.
to_a
.
compact
.
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
end
end
def
groups
@user
.
authorized_groups
.
sort_by
(
&
:path
).
map
{
|
group
|
{
username:
group
.
path
,
name:
group
.
name
}
}
end
def
all_members
def
all_members
[{
username:
"all"
,
name:
"Project and Group Members"
}]
[{
username:
"all"
,
name:
"Project and Group Members"
}]
end
end
...
...
doc/markdown/markdown.md
View file @
9910b7ff
...
@@ -170,7 +170,7 @@ GFM will turn that reference into a link so you can navigate between them easily
...
@@ -170,7 +170,7 @@ GFM will turn that reference into a link so you can navigate between them easily
GFM will recognize the following:
GFM will recognize the following:
- @foo : for
team member
s
- @foo : for
specific team members or group
s
- @all : for the whole team
- @all : for the whole team
- #123 : for issues
- #123 : for issues
- !123 : for merge requests
- !123 : for merge requests
...
...
lib/gitlab/markdown.rb
View file @
9910b7ff
...
@@ -202,8 +202,15 @@ module Gitlab
...
@@ -202,8 +202,15 @@ module Gitlab
if
identifier
==
"all"
if
identifier
==
"all"
link_to
(
"@all"
,
project_url
(
project
),
options
)
link_to
(
"@all"
,
project_url
(
project
),
options
)
elsif
User
.
find_by
(
username:
identifier
)
elsif
namespace
=
Namespace
.
find_by
(
path:
identifier
)
link_to
(
"@
#{
identifier
}
"
,
user_url
(
identifier
),
options
)
url
=
if
namespace
.
type
==
"Group"
group_url
(
identifier
)
else
user_url
(
identifier
)
end
link_to
(
"@
#{
identifier
}
"
,
url
,
options
)
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