Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/floc_opt_out.rb')
-rw-r--r--app/controllers/concerns/floc_opt_out.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/concerns/floc_opt_out.rb b/app/controllers/concerns/floc_opt_out.rb
new file mode 100644
index 00000000000..3039af02bbb
--- /dev/null
+++ b/app/controllers/concerns/floc_opt_out.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module FlocOptOut
+ extend ActiveSupport::Concern
+
+ included do
+ after_action :set_floc_opt_out_header, unless: :floc_enabled?
+ end
+
+ def floc_enabled?
+ Gitlab::CurrentSettings.floc_enabled
+ end
+
+ def set_floc_opt_out_header
+ response.headers['Permissions-Policy'] = 'interest-cohort=()'
+ end
+end