debian-mirror-gitlab/app/services/resource_events/base_change_timebox_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
591 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
module ResourceEvents
class BaseChangeTimeboxService
2021-03-11 19:13:27 +05:30
attr_reader :resource, :user
2020-10-24 23:57:45 +05:30
2021-03-11 19:13:27 +05:30
def initialize(resource, user)
2020-10-24 23:57:45 +05:30
@resource = resource
@user = user
end
def execute
create_event
resource.expire_note_etag_cache
end
private
def create_event
raise NotImplementedError
end
def build_resource_args
2022-07-23 23:45:48 +05:30
key = resource.class.base_class.name.foreign_key
2020-10-24 23:57:45 +05:30
{
user_id: user.id,
2021-03-11 19:13:27 +05:30
created_at: resource.system_note_timestamp,
2020-10-24 23:57:45 +05:30
key => resource.id
}
end
end
end