Retrospring/app/controllers/feedback_controller.rb

33 lines
720 B
Ruby
Raw Normal View History

2022-01-21 23:16:55 -08:00
# frozen_string_literal: true
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
class FeedbackController < ApplicationController
before_action :authenticate_user!
before_action :feature_enabled?
before_action :canny_consent_given?, only: %w[features bugs]
2022-01-21 23:16:55 -08:00
def consent
redirect_to feedback_bugs_path if current_user.has_cached_role? :canny_consent
end
2022-01-21 15:33:37 -08:00
def update
2022-01-21 23:16:55 -08:00
return unless params[:consent] == "true"
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
current_user.add_role :canny_consent
redirect_to feedback_bugs_path
end
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
def features; end
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
def bugs; end
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
private
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
def feature_enabled?
redirect_to root_path if APP_CONFIG["canny"].nil?
end
2022-01-21 15:33:37 -08:00
2022-01-21 23:16:55 -08:00
def canny_consent_given?
redirect_to feedback_consent_path unless current_user.has_cached_role? :canny_consent
2022-01-21 23:16:55 -08:00
end
2022-01-21 15:33:37 -08:00
end