diff options
Diffstat (limited to 'app/models/note.rb')
| -rw-r--r-- | app/models/note.rb | 16 | 
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 6f1b1a4da94..f0ed7580b4c 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -80,7 +80,7 @@ class Note < ActiveRecord::Base        note_options = {          project: project,          author: author, -        note: "_mentioned in #{gfm_reference}_", +        note: cross_reference_note_content(gfm_reference),          system: true        } @@ -174,7 +174,7 @@ class Note < ActiveRecord::Base                  where(noteable_id: noteable.id)                end -      notes.where('note like ?', "_mentioned in #{gfm_reference}_"). +      notes.where('note like ?', cross_reference_note_content(gfm_reference)).          system.any?      end @@ -182,8 +182,16 @@ class Note < ActiveRecord::Base        where("note like :query", query: "%#{query}%")      end +    def cross_reference_note_prefix +      '_mentioned in ' +    end +      private +    def cross_reference_note_content(gfm_reference) +      cross_reference_note_prefix + "#{gfm_reference}_" +    end +      # Prepend the mentioner's namespaced project path to the GFM reference for      # cross-project references.  For same-project references, return the      # unmodified GFM reference. @@ -249,6 +257,10 @@ class Note < ActiveRecord::Base      nil    end +  def cross_reference? +    note.start_with?(self.class.cross_reference_note_prefix) +  end +    def find_diff      return nil unless noteable && noteable.diffs.present?  | 
