Revert "FIX: Use Guardian.basic_user instead of new (anon) (#270)" (#271)

This reverts commit 7edf6d86e4.
This commit is contained in:
Martin Brennan 2023-12-06 16:26:40 +10:00 committed by GitHub
parent 7edf6d86e4
commit 3d3f20b68d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 8 deletions

View File

@ -1,4 +1,3 @@
< 3.2.0.beta4-dev: ad1b7c9608bf32c3a991580347302a071d5902d9
< 3.2.0.beta2-dev: 9fbf43e2f077e86f0a1ff769af6036d4e78bfff1
3.1.999: b5d487d6a5bfe2571d936eec5911d02a5f3fcc32
3.1.0.beta1: 62fe282c756ac7de43a22a09b0d675882a507743

View File

@ -703,10 +703,8 @@ SQL
category_id_changes = topic_changes.diff["category_id"].to_a
tag_changes = topic_changes.diff["tags"].to_a
old_allowed =
Guardian.basic_user.allow_accepted_answers?(category_id_changes[0], tag_changes[0])
new_allowed =
Guardian.basic_user.allow_accepted_answers?(category_id_changes[1], tag_changes[1])
old_allowed = Guardian.new.allow_accepted_answers?(category_id_changes[0], tag_changes[0])
new_allowed = Guardian.new.allow_accepted_answers?(category_id_changes[1], tag_changes[1])
options[:refresh_stream] = true if old_allowed != new_allowed
end

View File

@ -5,7 +5,7 @@ require_dependency "site"
describe Site do
let(:category) { Fabricate(:category) }
let(:guardian) { Guardian.basic_user }
let(:guardian) { Guardian.new }
before { SiteSetting.show_filter_by_solved_status = true }

View File

@ -5,7 +5,7 @@ require "rails_helper"
describe TopicAnswerMixin do
let(:topic) { Fabricate(:topic) }
let(:post) { Fabricate(:post, topic: topic) }
let(:guardian) { Guardian.basic_user }
let(:guardian) { Guardian.new }
before do
topic.custom_fields["accepted_answer_post_id"] = post.id

View File

@ -4,7 +4,7 @@ require "rails_helper"
describe UserCardSerializer do
let(:user) { Fabricate(:user) }
let(:serializer) { described_class.new(user, scope: Guardian.basic_user, root: false) }
let(:serializer) { described_class.new(user, scope: Guardian.new, root: false) }
let(:json) { serializer.as_json }
it "accepted_answers serializes number of accepted answers" do