Skip to content

Commit

Permalink
Add a feature flag (disabled) for the user research banner
Browse files Browse the repository at this point in the history
Trello: https://trello.com/c/cOsB2851

We've decided to disable the user research recruitment banner for
now. I considered removing all of the relevant code but after talking
to Joseph and Chris it seems likely that we'll want to bring this back
in a month or two *and* retain the user's preference for hiding it.

I couldn't think of a great way of retaining the data in the
`user_research_recruitment_banner_hidden` column on `users` and remind
our future selves that we should use this data if we restore the
banner from the git history. So instead I've decided to add a feature
flag, turned off in production and development, but enabled in
test (so we can retain the current test code too).

I'm not 100% convinced that keeping dead code around is a good idea,
but based on what I know now this seems ok. If it turns out that we
don't reinstate the banner in a couple of months I think the code and
data should be deleted.
  • Loading branch information
chrislo committed Sep 11, 2023
1 parent 6d625fc commit d257fc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/root_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def privacy_notice; end
private

def show_user_research_recruitment_banner?
!cookies[:dismiss_user_research_recruitment_banner] && !current_user.user_research_recruitment_banner_hidden?
Rails.application.config.show_user_research_recruitment_banner &&
!cookies[:dismiss_user_research_recruitment_banner] &&
!current_user.user_research_recruitment_banner_hidden?
end
helper_method :show_user_research_recruitment_banner?
end
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,7 @@ class Application < Rails::Application

cookies.rotate :encrypted, secret
end

config.show_user_research_recruitment_banner = false
end
end
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@

config.logger = Logger.new($stdout)
config.log_level = :fatal

config.show_user_research_recruitment_banner = true
end

0 comments on commit d257fc2

Please sign in to comment.