Skip to content
Snippets Groups Projects

Accept maintainer_note parameter in REST runner registration

Merged Pedro Pombeiro requested to merge pedropombeiro/348299/2-add-notes-param-in-rest-api into master
8 files
+ 52
15
Compare changes
  • Side-by-side
  • Inline
Files
8
@@ -49,9 +49,13 @@ def execute_single
# rubocop: disable CodeReuse/ActiveRecord
def execute_optimized_multi(users)
Gitlab::Pagination::Keyset::InOperatorOptimization::QueryBuilder.new(
scope: Event.reorder(:id),
scope: Event.reorder(id: :desc),
array_scope: User.select(:id).where(id: users),
array_mapping_scope: -> (author_id_expression) { Event.where(Event.arel_table[:author_id].eq(author_id_expression)) },
# Event model has a default scope { reorder(nil) }
# When a relation is rordered and used as a target when merging scope,
# its order takes a precedence and _overwrites_ the original scope's order.
# Thus we have to explicitly provide `reorder` for array_mapping_scope here.
array_mapping_scope: -> (author_id_expression) { Event.where(Event.arel_table[:author_id].eq(author_id_expression)).reorder(id: :desc) },
finder_query: -> (id_expression) { Event.where(Event.arel_table[:id].eq(id_expression)) }
)
.execute
Loading