diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-16 14:36:31 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-16 14:36:31 +0300 |
commit | 903132bc079970787333347209f6baebdd48800f (patch) | |
tree | ac7d39c58313ce09fb726335762b0ebbc7b8bc3c /app/services | |
parent | 5fa0248966316d672429eabc46407e1429ef2283 (diff) | |
parent | 92bb845e1ed18395615ba8a252de4a8b123c1914 (diff) |
Merge branch 'fix-ext-issue-webbased-hooks' into 'master'
Fix hooks for web based events with external issue references
The creation of cross references for external issues (which would fail)
is now prevented. This fixes a 500 error and the execution of hooks when
creating a merge request or commenting on one.
Fixes #1650, GH-9333.
This regression might have been introduced by
8f8a8ab32bca8fdc79d7a5115eabbd015dd44c02. There is actually a TODO by
@rspeicher mentioning external issues which is lost (unhandled) in a
later commit.
This fix is related to !766 and !804 which fix a similar issue for hooks for
Git based events.
See merge request !794
Diffstat (limited to 'app/services')
-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) |