diff --git a/app/graph/mutations/fact_check_mutations.rb b/app/graph/mutations/fact_check_mutations.rb index 0cf987c239..b6378feabd 100644 --- a/app/graph/mutations/fact_check_mutations.rb +++ b/app/graph/mutations/fact_check_mutations.rb @@ -1,6 +1,6 @@ module FactCheckMutations MUTATION_TARGET = 'fact_check'.freeze - PARENTS = ['claim_description'].freeze + PARENTS = ['claim_description', 'team'].freeze module SharedCreateAndUpdateFields extend ActiveSupport::Concern diff --git a/app/models/concerns/team_associations.rb b/app/models/concerns/team_associations.rb index 5d0cbb5adc..83cf62fa42 100644 --- a/app/models/concerns/team_associations.rb +++ b/app/models/concerns/team_associations.rb @@ -116,4 +116,8 @@ def check_search_unconfirmed def check_search_spam check_search_filter({ 'archived' => CheckArchivedFlags::FlagCodes::SPAM }) end + + def fact_checks + FactCheck.joins(:claim_description).where('claim_descriptions.team_id' => self.id) + end end diff --git a/app/models/fact_check.rb b/app/models/fact_check.rb index 5bae3620cb..3c4f559fc5 100644 --- a/app/models/fact_check.rb +++ b/app/models/fact_check.rb @@ -31,6 +31,10 @@ def team_id self.claim_description&.team_id end + def team + self.claim_description&.team + end + private def set_language diff --git a/lib/relay.idl b/lib/relay.idl index 739bd21531..d269943dcd 100644 --- a/lib/relay.idl +++ b/lib/relay.idl @@ -2609,6 +2609,7 @@ type CreateFactCheckPayload { clientMutationId: String fact_check: FactCheck fact_checkEdge: FactCheckEdge + team: Team } """ @@ -4212,6 +4213,7 @@ type DestroyFactCheckPayload { """ clientMutationId: String deletedId: ID + team: Team } """ @@ -15569,6 +15571,7 @@ type UpdateFactCheckPayload { clientMutationId: String fact_check: FactCheck fact_checkEdge: FactCheckEdge + team: Team } """ diff --git a/public/relay.json b/public/relay.json index c65add1375..f7a88f6e71 100644 --- a/public/relay.json +++ b/public/relay.json @@ -15674,6 +15674,20 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "team", + "description": null, + "args": [ + + ], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -23939,6 +23953,20 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "team", + "description": null, + "args": [ + + ], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -85316,6 +85344,20 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "team", + "description": null, + "args": [ + + ], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, diff --git a/test/models/fact_check_test.rb b/test/models/fact_check_test.rb index 8eb54a4318..670cd0e599 100644 --- a/test/models/fact_check_test.rb +++ b/test/models/fact_check_test.rb @@ -543,4 +543,9 @@ def setup fc.save! assert_equal 'in_progress', pm.reload.last_status end + + test "should have team" do + fc = create_fact_check + assert_not_nil fc.team + end end