mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FEATURE: allow users to select theme on single device
This commit is contained in:
parent
a0c936dadb
commit
e1dd543a93
11 changed files with 97 additions and 17 deletions
|
@ -267,13 +267,19 @@ class ApplicationController < ActionController::Base
|
|||
resolve_safe_mode
|
||||
return if request.env[NO_CUSTOM]
|
||||
|
||||
theme_key = flash[:preview_theme_key] || current_user&.user_option&.theme_key
|
||||
theme_key = flash[:preview_theme_key]
|
||||
|
||||
# TODO 2018: delete this, old cookie cleanup code
|
||||
if cookies[:theme_key]
|
||||
cookies.delete(:theme_key)
|
||||
user_option = current_user&.user_option
|
||||
|
||||
unless theme_key
|
||||
key, seq = cookies[:theme_key]&.split(",")
|
||||
if key && seq && seq.to_i == user_option&.theme_key_seq
|
||||
theme_key = key
|
||||
end
|
||||
end
|
||||
|
||||
theme_key ||= user_option&.theme_key
|
||||
|
||||
if theme_key && !guardian.allow_theme?(theme_key)
|
||||
theme_key = nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue