From ef288c67fed278da3da820da84e8521591e1f1c9 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 13 Sep 2023 02:30:40 +0000 Subject: [PATCH] Make sure action for toggling theme isn't available unless the user has permission --- app/controllers/themes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/themes_controller.rb b/app/controllers/themes_controller.rb index 55f1212d6..132833790 100644 --- a/app/controllers/themes_controller.rb +++ b/app/controllers/themes_controller.rb @@ -6,6 +6,8 @@ class ThemesController < ApplicationController sig { void } def toggle + return unless Flipper.enabled?(:switch_themes, current_user) + update_tailwind_theme(!show_tailwind_theme?) redirect_back(fallback_location: root_path) end