]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Merge remote-tracking branch 'upstream/pull/5398'
[rails.git] / app / controllers / application_controller.rb
index bde7e028765c81b5426a5eed2e8c74957abee4b2..32b53bad71c3f431d79234d65e354f6cafcf13c9 100644 (file)
@@ -279,7 +279,15 @@ class ApplicationController < ActionController::Base
     end
   end
 
     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)
 
   def update_totp
     if Settings.key?(:totp_key)