Class: Review

Inherits:
ApplicationRecord show all
Includes:
Mentionable, Participable
Defined in:
app/models/review.rb

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods included from Mentionable

#create_cross_references!, #create_new_cross_references!, #directly_addressed_users, #extractors, #gfm_reference, #local_reference, #matches_cross_reference_regex?, #mentioned_users, #referenced_group_users, #referenced_groups, #referenced_mentionables, #referenced_project_users, #referenced_projects, #referenced_users, #user_mention_class, #user_mention_identifier

Methods included from Participable

#participant?, #participants, #visible_participants

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#all_references(current_user = nil, extractor: nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'app/models/review.rb', line 21

def all_references(current_user = nil, extractor: nil)
  ext = super

  notes.each do |note|
    note.all_references(current_user, extractor: ext)
  end

  ext
end

#discussion_idsObject



17
18
19
# File 'app/models/review.rb', line 17

def discussion_ids
  notes.select(:discussion_id)
end

#from_merge_request_author?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/review.rb', line 35

def from_merge_request_author?
  merge_request.author_id == author_id
end

#user_mentionsObject



31
32
33
# File 'app/models/review.rb', line 31

def user_mentions
  merge_request.user_mentions.where.not(note_id: nil)
end