diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/models/review.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/models/review.rb')
-rw-r--r-- | app/models/review.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/models/review.rb b/app/models/review.rb new file mode 100644 index 00000000000..5a30e2963c8 --- /dev/null +++ b/app/models/review.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class Review < ApplicationRecord + include Participable + include Mentionable + + belongs_to :author, class_name: 'User', foreign_key: :author_id, inverse_of: :reviews + belongs_to :merge_request, inverse_of: :reviews + belongs_to :project, inverse_of: :reviews + + has_many :notes, -> { order(:id) }, inverse_of: :review + + delegate :name, to: :author, prefix: true + + participant :author + + def all_references(current_user = nil, extractor: nil) + ext = super + + notes.each do |note| + note.all_references(current_user, extractor: ext) + end + + ext + end + + def user_mentions + merge_request.user_mentions.where.not(note_id: nil) + end +end |