mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 16:29:32 +08:00
FIX: Use Guardian.basic_user instead of new (anon) (#24705)
c.f. de983796e1b66aa2ab039a4fb6e32cec8a65a098 There will soon be additional login_required checks for Guardian, and the intent of many checks by automated systems is better fulfilled by using BasicUser, which simulates a logged in TL0 forum user, rather than an anon user. In some cases the use of anon still makes sense (e.g. anonymous_cache), and in that case the more explicit `Guardian.anon_user` is used
This commit is contained in:
@ -169,7 +169,7 @@ module Middleware
|
||||
def theme_ids
|
||||
ids, _ = @request.cookies["theme_ids"]&.split("|")
|
||||
id = ids&.split(",")&.map(&:to_i)&.first
|
||||
if id && Guardian.new.allow_themes?([id])
|
||||
if id && Guardian.anon_user.allow_themes?([id])
|
||||
Theme.transform_ids(id)
|
||||
else
|
||||
[]
|
||||
|
Reference in New Issue
Block a user