Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-06-22 19:03:55 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-06-22 19:03:55 +0300
commit93ba5b9048aa6cff8e47c69a1cca4f240d6a64db (patch)
treec3f73b1f842acd7660d3998ede930435dca1c1c0
parent455b21c5a74402d058f45230ae43cd261064b0b5 (diff)
parent565f8f3ee4d0ee60082c5f927df2a249f94fad2a (diff)
Merge branch 'ext-issue-7-12' into '7-12-stable'
!794 for 7-12-stable Brings !794 to 7-12-stable. cc @jacobvosmaer See merge request !826
-rw-r--r--CHANGELOG1
-rw-r--r--app/services/system_note_service.rb4
-rw-r--r--spec/services/system_note_service_spec.rb9
3 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 42eb902fb2f..396a14b9d15 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@ v 7.12.0 (unreleased)
- Disable changing of target branch in new merge request page when a branch has already been specified (Stan Hu)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
- Update oauth button logos for Twitter and Google to recommended assets
+ - Fix hooks for web based events with external issue references (Daniel Gerhardt)
- Update browser gem to version 0.8.0 for IE11 support (Stan Hu)
- Fix timeout when rendering file with thousands of lines.
- Add "Remember me" checkbox to LDAP signin form.
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index b6801a92330..8253c1f780d 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -212,13 +212,15 @@ class SystemNoteService
# Check if a cross-reference is disallowed
#
# This method prevents adding a "mentioned in !1" note on every single commit
- # in a merge request.
+ # in a merge request. Additionally, it prevents the creation of references to
+ # external issues (which would fail).
#
# noteable - Noteable object being referenced
# mentioner - Mentionable object
#
# Returns Boolean
def self.cross_reference_disallowed?(noteable, mentioner)
+ return true if noteable.is_a?(ExternalIssue)
return false unless mentioner.is_a?(MergeRequest)
return false unless noteable.is_a?(Commit)
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 700286b585a..2658576640c 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -338,6 +338,15 @@ describe SystemNoteService do
to be_falsey
end
end
+
+ context 'when notable is an ExternalIssue' do
+ let(:noteable) { ExternalIssue.new('EXT-1234', project) }
+ it 'is truthy' do
+ mentioner = noteable.dup
+ expect(described_class.cross_reference_disallowed?(noteable, mentioner)).
+ to be_truthy
+ end
+ end
end
describe '.cross_reference_exists?' do