1# frozen_string_literal: true 2 3module Mutations 4 # This concern is deprecated and will be deleted in 14.6 5 # 6 # Use the SpamProtection concern instead. 7 module CanMutateSpammable 8 extend ActiveSupport::Concern 9 10 DEPRECATION_NOTICE = { 11 reason: 'Use spam protection with HTTP headers instead', 12 milestone: '13.11' 13 }.freeze 14 15 included do 16 argument :captcha_response, GraphQL::Types::String, 17 required: false, 18 deprecated: DEPRECATION_NOTICE, 19 description: 'Valid CAPTCHA response value obtained by using the provided captchaSiteKey with a CAPTCHA API to present a challenge to be solved on the client. Required to resubmit if the previous operation returned "NeedsCaptchaResponse: true".' 20 21 argument :spam_log_id, GraphQL::Types::Int, 22 required: false, 23 deprecated: DEPRECATION_NOTICE, 24 description: 'Spam log ID which must be passed along with a valid CAPTCHA response for the operation to be completed. Required to resubmit if the previous operation returned "NeedsCaptchaResponse: true".' 25 26 field :spam, 27 GraphQL::Types::Boolean, 28 null: true, 29 deprecated: DEPRECATION_NOTICE, 30 description: 'Indicates whether the operation was detected as definite spam. There is no option to resubmit the request with a CAPTCHA response.' 31 32 field :needs_captcha_response, 33 GraphQL::Types::Boolean, 34 null: true, 35 deprecated: DEPRECATION_NOTICE, 36 description: 'Indicates whether the operation was detected as possible spam and not completed. If CAPTCHA is enabled, the request must be resubmitted with a valid CAPTCHA response and spam_log_id included for the operation to be completed. Included only when an operation was not completed because "NeedsCaptchaResponse" is true.' 37 38 field :spam_log_id, 39 GraphQL::Types::Int, 40 null: true, 41 deprecated: DEPRECATION_NOTICE, 42 description: 'Spam log ID which must be passed along with a valid CAPTCHA response for an operation to be completed. Included only when an operation was not completed because "NeedsCaptchaResponse" is true.' 43 44 field :captcha_site_key, 45 GraphQL::Types::String, 46 null: true, 47 deprecated: DEPRECATION_NOTICE, 48 description: 'CAPTCHA site key which must be used to render a challenge for the user to solve to obtain a valid captchaResponse value. Included only when an operation was not completed because "NeedsCaptchaResponse" is true.' 49 end 50 end 51end 52