diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-06-08 18:13:14 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-06-08 18:13:14 -0400 |
commit | 23954b0f77ec048ed1a74eb30531c63de8b21b17 (patch) | |
tree | ab5a37a7927a9ba94b17df77062e6cab5c820eec /app | |
parent | b637f849503db06f38812184aec398f2e4e29d09 (diff) | |
download | gitlab-ce-23954b0f77ec048ed1a74eb30531c63de8b21b17.tar.gz |
Correctly remove already-mentioned commits for cross referencesrs-issue-1778
Fixes #1778
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/mentionable.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 6f9f54d08cc..10c39cb1ece 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -67,7 +67,13 @@ module Mentionable # Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+. def create_cross_references!(p = project, a = author, without = []) - refs = references(p) - without + refs = references(p) + + # We're using this method instead of Array diffing because that requires + # both of the object's `hash` values to be the same, which may not be the + # case for otherwise identical Commit objects. + refs.reject! { |ref| without.include?(ref) } + refs.each do |ref| Note.create_cross_reference_note(ref, local_reference, a) end |