Commit 8388bbe8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'notify-on-mention-everywhere' into 'master'

Notify on mention everywhere

Fixes gitlab/gitlabhq#1558

See merge request !1228
parents 6cb5d3d2 dade6650
...@@ -4,6 +4,7 @@ v 7.5.0 ...@@ -4,6 +4,7 @@ v 7.5.0
- Fix LDAP authentication for Git HTTP access - Fix LDAP authentication for Git HTTP access
- Fix LDAP config lookup for provider 'ldap' - Fix LDAP config lookup for provider 'ldap'
- Add Atlassian Bamboo CI service (Drew Blessing) - Add Atlassian Bamboo CI service (Drew Blessing)
- Mentioned @user will receive email even if he is not participating in issue or commit
v 7.4.2 v 7.4.2
- Fix internal snippet exposing for unauthenticated users - Fix internal snippet exposing for unauthenticated users
......
...@@ -51,12 +51,8 @@ module Mentionable ...@@ -51,12 +51,8 @@ module Mentionable
identifier = match.delete "@" identifier = match.delete "@"
if identifier == "all" if identifier == "all"
users += project.team.members.flatten users += project.team.members.flatten
else
if has_project
id = project.team.members.find_by(username: identifier).try(:id)
else else
id = User.find_by(username: identifier).try(:id) id = User.find_by(username: identifier).try(:id)
end
users << User.find(id) unless id.blank? users << User.find(id) unless id.blank?
end end
end end
......
...@@ -124,6 +124,7 @@ class NotificationService ...@@ -124,6 +124,7 @@ class NotificationService
opts = { noteable_type: note.noteable_type, project_id: note.project_id } opts = { noteable_type: note.noteable_type, project_id: note.project_id }
target = note.noteable target = note.noteable
if target.respond_to?(:participants) if target.respond_to?(:participants)
recipients = target.participants recipients = target.participants
else else
......
require 'spec_helper'
describe Issue, "Mentionable" do
describe :mentioned_users do
let!(:user) { create(:user, username: 'stranger') }
let!(:user2) { create(:user, username: 'john') }
let!(:issue) { create(:issue, description: '@stranger mentioned') }
subject { issue.mentioned_users }
it { should include(user) }
it { should_not include(user2) }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment