diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-05-20 19:40:54 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-05-20 19:40:54 -0500 |
commit | 152e9896c09b98287f73494d5d0ba553c4f459f3 (patch) | |
tree | 929b2f49c8dbf52e9d4ef99927a0cf489e343c6f /app/models/commit.rb | |
parent | ee62acf9915e7e0a26cf5fd9a2f4f4f9b2d64957 (diff) | |
download | gitlab-ce-dm-separate-banzai-references.tar.gz |
Make Mentionable and Participable share a ReferenceExtractordm-separate-banzai-references
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 3fea563a487..ffde9b5b732 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -8,11 +8,10 @@ class Commit include StaticModel attr_mentionable :safe_message, pipeline: :single_line - attr_mentionable :notes_with_associations - participant :author, index: 0 - participant :committer, index: 1 - participant :note_authors, index: 2 + participant :author + participant :committer + participant :notes_with_associations attr_accessor :project @@ -202,10 +201,6 @@ class Commit notes.includes(:author, :project) end - def note_authors - User.where(id: notes.select(:author_id)) - end - def method_missing(m, *args, &block) @raw.send(m, *args, &block) end @@ -263,12 +258,11 @@ class Commit end def has_been_reverted?(current_user = nil, noteable = self) - ext = Gitlab::ReferenceExtractor.new(project, current_user) - collection = noteable.notes_with_associations.system + ext = Gitlab::ReferenceExtractor.new(project, current_user || author) - # This is a bit of an odd setup since we want to analyze a custom - # collection instead of one returned by an attr_mentionable attribute. - noteable.analyze_references_in_collection(ext, collection) + noteable.notes.system.each do |note| + note.all_references(current_user, ext: ext) + end ext.commits.any? { |commit_ref| commit_ref.reverts_commit?(self) } end |