Redirect away from consent action if consent is already given

This commit is contained in:
Andreas Nedbal 2022-01-22 07:38:06 +01:00 committed by Andreas Nedbal
parent 0b76ceb73d
commit 4d4296de19
1 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,8 @@ class FeedbackController < ApplicationController
before_action :canny_consent_given?, only: %w(features bugs) before_action :canny_consent_given?, only: %w(features bugs)
def consent def consent
redirect_to feedback_bugs_path if current_user.has_role? :canny_consent
if params[:consent] === 'true' then if params[:consent] === 'true' then
current_user.add_role :canny_consent current_user.add_role :canny_consent
redirect_to feedback_bugs_path redirect_to feedback_bugs_path