Merge branch 'mention-groups'

Conflicts:
	CHANGELOG
This commit is contained in:
Dmitriy Zaporozhets
2015-02-06 16:45:37 -08:00
6 changed files with 27 additions and 11 deletions
+2 -1
View File
@@ -38,6 +38,7 @@ v 7.8.0
- Add a commit calendar to the user profile (Hannes Rosenögger)
-
- Submit comment on command-enter
- Notify all members of a group when that group is mentioned in a comment, for example: `@gitlab-org` or `@sales`.
-
- Fix long broadcast message cut-off on left sidebar (Visay Keo)
- Add Project Avatars (Steven Thonus and Hannes Rosenögger)
@@ -1126,4 +1127,4 @@ v 0.8.0
- stability
- security fixes
- increased test coverage
- email notification
- email notification
+1 -1
View File
@@ -102,7 +102,7 @@ class ProjectsController < ApplicationController
note_type = params['type']
note_id = params['type_id']
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 = {
emojis: autocomplete_emojis,
+6 -3
View File
@@ -51,9 +51,12 @@ module Mentionable
identifier = match.delete "@"
if identifier == "all"
users.push(*project.team.members.flatten)
else
id = User.find_by(username: identifier).try(:id)
users << User.find(id) unless id.blank?
elsif namespace = Namespace.find_by(path: identifier)
if namespace.type == "Group"
users.push(*namespace.users)
else
users << namespace.owner
end
end
end
users.uniq
@@ -1,7 +1,8 @@
module Projects
class ParticipantsService < BaseService
def initialize(project)
@project = project
def initialize(project, user)
@project = project
@user = user
end
def execute(note_type, note_id)
@@ -12,7 +13,7 @@ module Projects
[]
end
team_members = sorted(@project.team.members)
participants = all_members + team_members + participating
participants = all_members + groups + team_members + participating
participants.uniq
end
@@ -37,6 +38,10 @@ module Projects
users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
end
def groups
@user.authorized_groups.sort_by(&:path).map { |group| { username: group.path, name: group.name } }
end
def all_members
[{ username: "all", name: "Project and Group Members" }]
end
+1 -1
View File
@@ -170,7 +170,7 @@ GFM will turn that reference into a link so you can navigate between them easily
GFM will recognize the following:
- @foo : for team members
- @foo : for specific team members or groups
- @all : for the whole team
- #123 : for issues
- !123 : for merge requests
+9 -2
View File
@@ -202,8 +202,15 @@ module Gitlab
if identifier == "all"
link_to("@all", project_url(project), options)
elsif User.find_by(username: identifier)
link_to("@#{identifier}", user_url(identifier), options)
elsif namespace = Namespace.find_by(path: identifier)
url =
if namespace.type == "Group"
group_url(identifier)
else
user_url(identifier)
end
link_to("@#{identifier}", url, options)
end
end