mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Revert guardian changes (#24742)
I took the wrong approach here, need to rethink. * Revert "FIX: Use Guardian.basic_user instead of new (anon) (#24705)" This reverts commit9057272ee2. * Revert "DEV: Remove unnecessary method_missing from GuardianUser (#24735)" This reverts commita5d4bf6dd2. * Revert "DEV: Improve Guardian devex (#24706)" This reverts commit77b6a038ba. * Revert "FIX: Introduce Guardian::BasicUser for oneboxing checks (#24681)" This reverts commitde983796e1.
This commit is contained in:
@@ -22,7 +22,7 @@ class AboutController < ApplicationController
|
||||
end
|
||||
category_topic_ids = Category.select(:topic_id).where.not(topic_id: nil)
|
||||
public_topics =
|
||||
Topic.listable_topics.visible.secured(Guardian.anon_user).where.not(id: category_topic_ids)
|
||||
Topic.listable_topics.visible.secured(Guardian.new(nil)).where.not(id: category_topic_ids)
|
||||
stats = { public_topic_count: public_topics.count }
|
||||
stats[:public_post_count] = public_topics.sum(:posts_count) - stats[:public_topic_count]
|
||||
render json: stats
|
||||
|
||||
@@ -47,6 +47,6 @@ class EmailController < ApplicationController
|
||||
user = User.find_by_email(@email)
|
||||
raise Discourse::NotFound unless user
|
||||
topic = Topic.find_by(id: params[:topic_id].to_i) if @topic_id
|
||||
@topic = topic if topic && Guardian.anon_user.can_see?(topic)
|
||||
@topic = topic if topic && Guardian.new(nil).can_see?(topic)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user