summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/invisible_captcha_on_signup.rb4
-rw-r--r--app/controllers/concerns/issuable_actions.rb1
-rw-r--r--app/controllers/concerns/redis_tracking.rb2
-rw-r--r--app/controllers/concerns/show_inherited_labels_checker.rb11
-rw-r--r--app/controllers/concerns/spammable_actions.rb25
5 files changed, 23 insertions, 20 deletions
diff --git a/app/controllers/concerns/invisible_captcha_on_signup.rb b/app/controllers/concerns/invisible_captcha_on_signup.rb
index 9bea6145ff3..c7fd6d08744 100644
--- a/app/controllers/concerns/invisible_captcha_on_signup.rb
+++ b/app/controllers/concerns/invisible_captcha_on_signup.rb
@@ -8,7 +8,7 @@ module InvisibleCaptchaOnSignup
end
def on_honeypot_spam_callback
- return unless Feature.enabled?(:invisible_captcha)
+ return unless Gitlab::CurrentSettings.invisible_captcha_enabled
invisible_captcha_honeypot_counter.increment
log_request('Invisible_Captcha_Honeypot_Request')
@@ -17,7 +17,7 @@ module InvisibleCaptchaOnSignup
end
def on_timestamp_spam_callback
- return unless Feature.enabled?(:invisible_captcha)
+ return unless Gitlab::CurrentSettings.invisible_captcha_enabled
invisible_captcha_timestamp_counter.increment
log_request('Invisible_Captcha_Timestamp_Request')
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index 3b46a547d47..57d4203ad43 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -217,6 +217,7 @@ module IssuableActions
:issuable_ids,
:assignee_id,
:milestone_id,
+ :sprint_id,
:state_event,
:subscription_event,
assignee_ids: [],
diff --git a/app/controllers/concerns/redis_tracking.rb b/app/controllers/concerns/redis_tracking.rb
index d81bd10d5bb..d71935356b8 100644
--- a/app/controllers/concerns/redis_tracking.rb
+++ b/app/controllers/concerns/redis_tracking.rb
@@ -33,7 +33,7 @@ module RedisTracking
return unless metric_feature_enabled?(feature, feature_default_enabled)
return unless visitor_id
- Gitlab::UsageDataCounters::HLLRedisCounter.track_event(visitor_id, event_name)
+ Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: visitor_id)
end
def trackable_request?
diff --git a/app/controllers/concerns/show_inherited_labels_checker.rb b/app/controllers/concerns/show_inherited_labels_checker.rb
deleted file mode 100644
index 9847226f599..00000000000
--- a/app/controllers/concerns/show_inherited_labels_checker.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-module ShowInheritedLabelsChecker
- extend ActiveSupport::Concern
-
- private
-
- def show_inherited_labels?(include_ancestor_groups)
- Feature.enabled?(:show_inherited_labels, @project || @group, default_enabled: true) || include_ancestor_groups # rubocop:disable Gitlab/ModuleWithInstanceVariables
- end
-end
diff --git a/app/controllers/concerns/spammable_actions.rb b/app/controllers/concerns/spammable_actions.rb
index 50c93441dd4..4ec561014a8 100644
--- a/app/controllers/concerns/spammable_actions.rb
+++ b/app/controllers/concerns/spammable_actions.rb
@@ -32,10 +32,6 @@ module SpammableActions
elsif render_recaptcha?
ensure_spam_config_loaded!
- if params[:recaptcha_verification]
- flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
- end
-
respond_to do |format|
format.html do
render :verify
@@ -56,9 +52,9 @@ module SpammableActions
def spammable_params
default_params = { request: request }
- recaptcha_check = params[:recaptcha_verification] &&
+ recaptcha_check = recaptcha_response &&
ensure_spam_config_loaded! &&
- verify_recaptcha
+ verify_recaptcha(response: recaptcha_response)
return default_params unless recaptcha_check
@@ -66,6 +62,23 @@ module SpammableActions
spam_log_id: params[:spam_log_id] }.merge(default_params)
end
+ def recaptcha_response
+ # NOTE: This field name comes from `Recaptcha::ClientHelper#recaptcha_tags` in the recaptcha
+ # gem, which is called from the HAML `_recaptcha_form.html.haml` form.
+ #
+ # It is used in the `Recaptcha::Verify#verify_recaptcha` if the `response` option is not
+ # passed explicitly.
+ #
+ # Instead of relying on this behavior, we are extracting and passing it explicitly. This will
+ # make it consistent with the newer, modern reCAPTCHA verification process as it will be
+ # implemented via the GraphQL API and in Vue components via the native reCAPTCHA Javascript API,
+ # which requires that the recaptcha response param be obtained and passed explicitly.
+ #
+ # After this newer GraphQL/JS API process is fully supported by the backend, we can remove this
+ # (and other) HAML-specific support.
+ params['g-recaptcha-response']
+ end
+
def spammable
raise NotImplementedError, "#{self.class} does not implement #{__method__}"
end