diff options
author | Daniel Gerhardt <code@dgerhardt.net> | 2015-06-14 18:41:11 +0300 |
---|---|---|
committer | Daniel Gerhardt <code@dgerhardt.net> | 2015-06-14 18:41:11 +0300 |
commit | 92bb845e1ed18395615ba8a252de4a8b123c1914 (patch) | |
tree | 79167f865312bb98dd8a6c3b9d256a479ef8f3b7 /app/services/system_note_service.rb | |
parent | 5c6d83b8e772dedb753336d83783123e166fbe40 (diff) |
Fix hooks for web based events with external issue references
The creation of cross references for external issues (which would fail)
is now prevented.
Fixes #1650, GH-9333.
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r-- | app/services/system_note_service.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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) |