Commit b2d6ae0f authored by Kerri Miller's avatar Kerri Miller

Merge branch '205578-refactor-pkg-event-generation' into 'master'

Refactor package event list generation

See merge request gitlab-org/gitlab!48305
parents 8f51e3cc cfc4e738
......@@ -18,12 +18,12 @@ namespace :gitlab do
end
def event_pairs
::Packages::Event.event_types.keys.product(::Packages::Event.originator_types.keys)
::Packages::Event.event_types.keys.product(::Packages::Event::EVENT_SCOPES.keys)
end
def generate_unique_events_list
::Packages::Event::EVENT_SCOPES.keys.each_with_object([]) do |event_scope, events|
event_pairs.each do |event_type, originator|
events = event_pairs.each_with_object([]) do |(event_type, event_scope), events|
::Packages::Event.originator_types.keys.excluding('guest').each do |originator|
if name = ::Packages::Event.allowed_event_name(event_scope, event_type, originator)
events << {
"name" => name,
......@@ -35,6 +35,8 @@ namespace :gitlab do
end
end
end
events.sort_by { |event| event["name"] }
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment