WIP - fix and spec for cross reference issue with forks

This commit is contained in:
James Lopez 2016-02-04 18:36:16 +01:00
parent e933a50b6b
commit 9b925d79c9
2 changed files with 18 additions and 2 deletions

View File

@ -291,8 +291,8 @@ class SystemNoteService
notes = notes.where(noteable_id: noteable.id)
end
gfm_reference = mentioner.gfm_reference(noteable.project)
notes = notes.where(note: cross_reference_note_content(gfm_reference))
gfm_reference = mentioner.gfm_reference(nil)
notes = notes.where('note LIKE ?', "#{cross_reference_note_prefix}%#{gfm_reference}")
notes.count > 0
end

View File

@ -424,6 +424,22 @@ describe SystemNoteService, services: true do
to be_falsey
end
end
context 'commit from fork' do
let(:author2) { create(:user) }
let(:forked_project) { Projects::ForkService.new(project, author2).execute }
let(:service) { CreateCommitBuildsService.new }
let(:commit2) { forked_project.commit }
before do
described_class.cross_reference(commit0, commit2, author2)
end
it 'is falsey when is a fork mentioning an external issue' do
expect(described_class.cross_reference_exists?(commit0, commit2)).
to be_falsey
end
end
end
include JiraServiceHelper