From cb97946cc90cf337402d2424899a20387f085a9a Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Wed, 30 Oct 2024 09:27:54 -0300 Subject: [PATCH] check the lapis code error instead of text message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (1) If I18n.locale is not English, then this error message will be localized, so won't match this condition (for example, for Portuguese it will be "Este item já existe"). (2) The copy for the error message may change in the future. --- app/graph/mutations/graphql_crud_operations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/graph/mutations/graphql_crud_operations.rb b/app/graph/mutations/graphql_crud_operations.rb index 21b793f73..b5c07ea73 100644 --- a/app/graph/mutations/graphql_crud_operations.rb +++ b/app/graph/mutations/graphql_crud_operations.rb @@ -11,7 +11,7 @@ def self.safe_save(obj, attrs, parent_names = []) begin obj.save_with_version! rescue RuntimeError => e - if e.message.include?("This item already exists") && + if e.message.include?("\"code\":9") && obj.is_a?(ProjectMedia) && obj.set_fact_check.present? && obj.set_original_claim.present?