From 55beb5cf88b38313152938946520f08bad61b717 Mon Sep 17 00:00:00 2001 From: Caio Almeida <117518+caiosba@users.noreply.github.com> Date: Mon, 25 Sep 2023 13:24:47 -0300 Subject: [PATCH] Use "random" argument passed to GraphQL team query This is temporarily needed in order to bypass Relay compat cache. Shouldn't be needed once the client is completely migrated to Relay modern. Fixes CV2-3775. --- app/graph/types/query_type.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/graph/types/query_type.rb b/app/graph/types/query_type.rb index 09d8ac04bc..0a22788984 100644 --- a/app/graph/types/query_type.rb +++ b/app/graph/types/query_type.rb @@ -79,12 +79,13 @@ def me argument :random, GraphQL::Types::String, required: false end - def team(id: nil, slug: nil, _random: nil) + def team(id: nil, slug: nil, random: nil) tid = id.to_i - if !slug.blank? + unless slug.blank? team = Team.where(slug: slug).first tid = team.id unless team.nil? end + team.reload if random tid = Team.current&.id || User.current&.teams&.first&.id if tid === 0 GraphqlCrudOperations.load_if_can(Team, tid.to_i, context) end