]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Fix options passed by allow_thirdparty_images
[rails.git] / app / controllers / application_controller.rb
index bde7e028765c81b5426a5eed2e8c74957abee4b2..1ef49bf4629c209a6e14a61c3fc97656c5405420 100644 (file)
@@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base
   helper_method :oauth_token
 
   def self.allow_thirdparty_images(**options)
-    content_security_policy(options) do |policy|
+    content_security_policy(**options) do |policy|
       policy.img_src("*", :data)
     end
   end
@@ -279,7 +279,15 @@ class ApplicationController < ActionController::Base
     end
   end
 
-  helper_method :preferred_editor
+  def preferred_color_scheme(subject)
+    if current_user
+      current_user.preferences.find_by(:k => "#{subject}.color_scheme")&.v || "auto"
+    else
+      "auto"
+    end
+  end
+
+  helper_method :preferred_editor, :preferred_color_scheme
 
   def update_totp
     if Settings.key?(:totp_key)