Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple feature flag for feedback that can be enabled / disabled per env #3655

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/footer_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="site-footer-bottom">
<div class="site-footer-bottom__links-container">
<%= link_to("Search", search_path) %>
<%= link_to "Feedback", feedback_steps_path %>
<%= link_to "Feedback", feedback_steps_path if Rails.application.config.x.feature_flags.feedback_enabled %>
<%= link_to "Cookies", cookies_path %>
<%= link_to "Privacy notice", privacy_policy_path %>
<%= link_to("Accessibility", page_path(page: :accessibility)) %>
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/feedback/steps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class StepsController < ApplicationController
include GITWizard::Controller
self.wizard_class = Feedback::Wizard

before_action :check_feature_flag!
before_action :set_step_page_title, only: %i[show update]
before_action :set_completed_page_title, only: [:completed]

Expand All @@ -16,6 +17,10 @@ def not_available

private

def check_feature_flag!
redirect_to "/" unless Rails.application.config.x.feature_flags.feedback_enabled
end

def first_step_class
wizard_class.steps.first
end
Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

config.x.dfe_analytics = true

config.x.feature_flags.feedback_enabled = true

# Allow access from Codespaces
config.hosts << /[a-z0-9\-]+\.(preview\.app\.github|githubpreview)\.dev/
end
2 changes: 2 additions & 0 deletions config/environments/pagespeed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require File.expand_path("production.rb", __dir__)

Rails.application.configure do
config.x.feature_flags.feedback_enabled = true

# Override any production defaults here
config.x.git_api_endpoint = \
"https://getintoteachingapi-test.test.teacherservices.cloud/api"
Expand Down
2 changes: 2 additions & 0 deletions config/environments/preprod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
config.view_component.show_previews = true

config.x.dfe_analytics = true

config.x.feature_flags.feedback_enabled = true
end
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@

config.x.dfe_analytics = true

config.x.feature_flags.feedback_enabled = false

# Ensure beta redirect happens before static page cache.
config.middleware.insert_before ActionDispatch::Static, Rack::HostRedirect, {
"beta-getintoteaching.education.gov.uk" => "getintoteaching.education.gov.uk",
Expand Down
2 changes: 2 additions & 0 deletions config/environments/rolling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
config.x.display_content_errors = true

config.x.dfe_analytics = true

config.x.feature_flags.feedback_enabled = true
end
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
config.x.integration_credentials = { username: ENV["HTTP_USERNAME"], password: ENV["HTTP_PASSWORD"] }
config.x.mailsac_api_key = ENV["MAILSAC_API_KEY"]
config.x.dfe_analytics = true
config.x.feature_flags.feedback_enabled = true
end