Commit baa1e3d0 authored by charlie ablett's avatar charlie ablett

Merge branch 'ajk-13984-extracted-mr-3' into 'master'

General code improvements

See merge request gitlab-org/gitlab!53316
parents f35cf342 491094c6
......@@ -28,7 +28,7 @@ module Resolvers
context.scoped_set!(:issue_filters, issue_filters(issue_filters))
if load_preferences?(lookahead)
List.preload_preferences_for_user(lists, context[:current_user])
List.preload_preferences_for_user(lists, current_user)
end
offset_pagination(lists)
......@@ -39,7 +39,7 @@ module Resolvers
def board_lists(id)
service = ::Boards::Lists::ListService.new(
board.resource_parent,
context[:current_user],
current_user,
list_id: extract_list_id(id)
)
......@@ -47,7 +47,8 @@ module Resolvers
end
def load_preferences?(lookahead)
lookahead&.selection(:edges)&.selection(:node)&.selects?(:collapsed)
lookahead&.selection(:edges)&.selection(:node)&.selects?(:collapsed) ||
lookahead&.selection(:nodes)&.selects?(:collapsed)
end
def extract_list_id(gid)
......
......@@ -15,13 +15,10 @@ module Resolvers
required: false,
description: 'Paths of the blobs.'
def resolve(**args)
def resolve(paths: [])
authorize!(snippet)
return [snippet.blob] if snippet.empty_repo?
paths = Array(args.fetch(:paths, []))
if paths.empty?
snippet.blobs
else
......
......@@ -30,7 +30,7 @@ module Types
def resolve_field(obj, args, ctx)
ctx.schema.after_lazy(obj) do |after_obj|
query_ctx = ctx.query.context
inner_obj = after_obj && after_obj.object
inner_obj = after_obj&.object
ctx.schema.after_lazy(to_ruby_args(after_obj, args, ctx)) do |ruby_args|
if authorized?(inner_obj, ruby_args, query_ctx)
......
......@@ -44,7 +44,7 @@ RSpec.describe Resolvers::Boards::EpicBoardsResolver do
it 'returns epic boards in the group ordered by name' do
expect(result)
.to contain_exactly(epic_board2, epic_board1)
.and be_sorted(:name, :asc)
.and be_sorted.asc.by(&:name)
end
context 'when epic_boards flag is disabled' do
......
......@@ -10,7 +10,7 @@ RSpec.describe Resolvers::IncidentManagement::OncallShiftsResolver do
let_it_be(:project) { rotation.project }
let(:args) { { start_time: rotation.starts_at, end_time: rotation.starts_at + rotation.shift_duration } }
subject(:shifts) { sync(resolve_oncall_shifts(args)) }
subject(:shifts) { sync(resolve_oncall_shifts(args).to_a) }
before do
stub_licensed_features(oncall_schedules: true)
......
......@@ -105,7 +105,7 @@ RSpec.shared_examples 'querying a GraphQL type with labels' do
run_query(query_for(label_a))
end
it 'batches queries for labels by title' do
it 'batches queries for labels by title', :request_store do
multi_selection = query_for(label_b, label_c)
single_selection = query_for(label_d)
......
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