Merge branch 'fix/todos-for-private-group-mentions' into 'master'

Fix adding a todo for private group memebers



See merge request !4081
This commit is contained in:
Douwe Maan 2016-05-09 18:31:41 +00:00
commit 93b4a3a156
3 changed files with 22 additions and 2 deletions

View File

@ -35,6 +35,7 @@ v 8.8.0 (unreleased)
- Fix Gravatar hint in user profile when Gravatar is disabled. !3988 (Artem Sidorenko)
- Expire repository exists? and has_visible_content? caches after a push if necessary
- Fix unintentional filtering bug in issues sorted by milestone due (Takuya Noguchi)
- Fix adding a todo for private group members (Ahmad Sherif)
v 8.7.4
- Fix always showing build notification message when switching between merge requests

View File

@ -43,8 +43,8 @@ module Mentionable
self
end
def all_references(current_user = self.author, text = nil)
ext = Gitlab::ReferenceExtractor.new(self.project, current_user, self.author)
def all_references(current_user = nil, text = nil)
ext = Gitlab::ReferenceExtractor.new(self.project, current_user || self.author, self.author)
if text
ext.analyze(text)

View File

@ -55,6 +55,25 @@ describe TodoService, services: true do
should_create_todo(user: admin, target: confidential_issue, author: john_doe, action: Todo::MENTIONED)
should_not_create_todo(user: john_doe, target: confidential_issue, author: john_doe, action: Todo::MENTIONED)
end
context 'when a private group is mentioned' do
let(:group) { create :group, :private }
let(:project) { create :project, :private, group: group }
let(:issue) { create :issue, author: author, project: project, description: group.to_reference }
before do
group.add_owner(author)
group.add_user(member, Gitlab::Access::DEVELOPER)
group.add_user(john_doe, Gitlab::Access::DEVELOPER)
service.new_issue(issue, author)
end
it 'creates a todo for group members' do
should_create_todo(user: member, target: issue)
should_create_todo(user: john_doe, target: issue)
end
end
end
describe '#update_issue' do