Fix blockedByCount GraphQL field
requested to merge 416768-linked-items-be-add-support-for-querying-linked-items-using-graphql-3 into master
What does this MR do and why?
In !128152 (merged) we added the GQL aggregator WorkItems::LazyLinksAggregate
for blockingCount
and blockedByCount
fields but we didn't resolve the method links_aggregate
which results in an internal server error when calling the count fields:
undefined method `to_i' for #<Gitlab::Graphql::Aggregations::WorkItems::LazyLinksAggregate:0x00007f572a9dce10 @issuable_id=132216329, @link_type="blocked", @block=#<Proc:0x00007f572a9dcd98 /srv/gitlab/ee/app/graphql/ee/types/work_items/widgets/linked_items_type.rb:33>, @lazy_state={:pending_ids=>{"blocked"=>#<Set: {132216329}>, "blocking"=>#<Set: {}>}, :loaded_objects=>{"blocked"=>{}, "blocking"=>{}}}> Did you mean? to_s
This MR adds lazy_resolve
for this aggregator so loaded_objects
is populated with the counts and the block is called correctly for the coun fields.
Additionality, it's included in this MR a small fix for Project#linked_work_items_feature_flag_enabled?
because the feature flag was not working when scoped to a project.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #416768 (closed)
Edited by Eugenia Grieff