diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index d0d9ecab4..297c303f8 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -18,7 +18,7 @@ def signin_required private def show_user_research_recruitment_banner? - !cookies[:dismiss_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 diff --git a/app/controllers/user_research_recruitment_controller.rb b/app/controllers/user_research_recruitment_controller.rb index 67abc19a7..a34ac90e2 100644 --- a/app/controllers/user_research_recruitment_controller.rb +++ b/app/controllers/user_research_recruitment_controller.rb @@ -1,9 +1,15 @@ class UserResearchRecruitmentController < ApplicationController + USER_RESEARCH_RECRUITMENT_FORM_URL = "https://docs.google.com/forms/d/1Bdu_GqOrSR4j6mbuzXkFTQg6FRktRMQc8Y-q879Mny8/viewform".freeze + before_action :authenticate_user! skip_after_action :verify_authorized def update - if params[:choice] == "dismiss-banner" + case params[:choice] + when "participate" + current_user.update!(user_research_recruitment_banner_hidden: true) + redirect_to USER_RESEARCH_RECRUITMENT_FORM_URL, allow_other_host: true + when "dismiss-banner" cookies[:dismiss_user_research_recruitment_banner] = true redirect_to root_path end diff --git a/app/views/root/index.html.erb b/app/views/root/index.html.erb index 89b09ab94..efeb971fd 100644 --- a/app/views/root/index.html.erb +++ b/app/views/root/index.html.erb @@ -9,7 +9,7 @@

We're holding research sessions to make Publishing work better.

<%= form_tag user_research_recruitment_update_path, method: :put do %>
-