Class: ResourceLabelEvent
Constant Summary
CacheMarkdownField::INVALIDATED_BY
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
#skip_markdown_cache_validation
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
#attribute_invalidated?, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #local_version, #mentionable_attributes_changed?, #mentioned_filtered_user_ids_for, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #updated_cached_html_for
#discussion_id
#trigger_note_subscription_create, #work_item_synthetic_system_note
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
#serializable_hash
Class Method Details
.issuable_attrs ⇒ Object
23
24
25
|
# File 'app/models/resource_label_event.rb', line 23
def self.issuable_attrs
%i[issue merge_request].freeze
end
|
.preload_label_subjects(events) ⇒ Object
27
28
29
30
31
32
33
|
# File 'app/models/resource_label_event.rb', line 27
def self.preload_label_subjects(events)
labels = events.map(&:label).compact
project_labels, group_labels = labels.partition { |label| label.is_a? ProjectLabel }
ActiveRecord::Associations::Preloader.new(records: project_labels, associations: { project: :project_feature }).call
ActiveRecord::Associations::Preloader.new(records: group_labels, associations: :group).call
end
|
.visible_to_user?(user, events) ⇒ Boolean
Instance Method Details
#banzai_render_context(field) ⇒ Object
57
58
59
|
# File 'app/models/resource_label_event.rb', line 57
def banzai_render_context(field)
super.merge(pipeline: :label, only_path: true, label_url_method: label_url_method)
end
|
#group ⇒ Object
47
48
49
|
# File 'app/models/resource_label_event.rb', line 47
def group
issuable.group if issuable.respond_to?(:group)
end
|
#issuable ⇒ Object
35
36
37
|
# File 'app/models/resource_label_event.rb', line 35
def issuable
issue || merge_request
end
|
#outdated_markdown? ⇒ Boolean
51
52
53
54
55
|
# File 'app/models/resource_label_event.rb', line 51
def outdated_markdown?
return true if label_id.nil? && reference.present?
reference.nil? || latest_cached_markdown_version != cached_markdown_version
end
|
#project ⇒ Object
43
44
45
|
# File 'app/models/resource_label_event.rb', line 43
def project
issuable.project
end
|
#refresh_invalid_reference ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'app/models/resource_label_event.rb', line 61
def refresh_invalid_reference
self.reference = '' if label_id.nil?
self.reference ||= label_reference
if changed?
save
elsif invalidated_markdown_cache?
refresh_markdown_cache!
end
end
|
#synthetic_note_class ⇒ Object
39
40
41
|
# File 'app/models/resource_label_event.rb', line 39
def synthetic_note_class
LabelNote
end
|