BigW Consortium Gitlab

Commit fd17ba9f by Dmitriy Zaporozhets

Mentioned users are not limited by project scope any more

parent 408bbb1b
......@@ -52,11 +52,7 @@ module Mentionable
if identifier == "all"
users += project.team.members.flatten
else
if has_project
id = project.team.members.find_by(username: identifier).try(:id)
else
id = User.find_by(username: identifier).try(:id)
end
id = User.find_by(username: identifier).try(:id)
users << User.find(id) unless id.blank?
end
end
......
......@@ -124,6 +124,7 @@ class NotificationService
opts = { noteable_type: note.noteable_type, project_id: note.project_id }
target = note.noteable
if target.respond_to?(:participants)
recipients = target.participants
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