diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-15 15:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-15 15:09:26 +0300 |
commit | 9215d9f7619929f9da16744fa37636635b66949b (patch) | |
tree | 754fa5c3a99700176b117d96b30268cbd3c07581 /app/models/audit_event.rb | |
parent | a898b6057ecf9ab635c45217568d44eab5c32ec0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/audit_event.rb')
-rw-r--r-- | app/models/audit_event.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 392f8d647a1..3d36214a178 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -19,7 +19,15 @@ class AuditEvent < ApplicationRecord scope :by_entity_id, -> (entity_id) { where(entity_id: entity_id) } scope :by_author_id, -> (author_id) { where(author_id: author_id) } + PARALLEL_PERSISTENCE_COLUMNS = [:author_name].freeze + after_initialize :initialize_details + # Note: The intention is to remove this once refactoring of AuditEvent + # has proceeded further. + # + # See further details in the epic: + # https://gitlab.com/groups/gitlab-org/-/epics/2765 + after_validation :parallel_persist def self.order_by(method) case method.to_s @@ -55,6 +63,10 @@ class AuditEvent < ApplicationRecord def default_author_value ::Gitlab::Audit::NullAuthor.for(author_id, (self[:author_name] || details[:author_name])) end + + def parallel_persist + PARALLEL_PERSISTENCE_COLUMNS.each { |col| self[col] = details[col] } + end end AuditEvent.prepend_if_ee('EE::AuditEvent') |