FIX: serialize can_ignore_users (#25672)
Bug introduced in this PR https://github.com/discourse/discourse/pull/25585/files#diff-55dea7dea5b8655da575a2f23156240686c956d081d36ea9976d38b29b72b5d2R130 `can_ignore_users` method was created but not added to attributes and therefore it was not serialized.
This commit is contained in:
parent
709bed5d1c
commit
c03d22f633
|
@ -25,6 +25,7 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:no_password,
|
||||
:can_delete_account,
|
||||
:can_post_anonymously,
|
||||
:can_ignore_users,
|
||||
:custom_fields,
|
||||
:muted_category_ids,
|
||||
:indirectly_muted_category_ids,
|
||||
|
|
|
@ -150,6 +150,27 @@ RSpec.describe CurrentUserSerializer do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#can_ignore_users" do
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
let(:payload) { serializer.as_json }
|
||||
|
||||
context "when user is a regular one" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
it "return false for regular users" do
|
||||
expect(payload[:can_ignore_users]).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
context "when user is a staff member" do
|
||||
let(:user) { Fabricate(:moderator) }
|
||||
|
||||
it "returns true" do
|
||||
expect(payload[:can_ignore_users]).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#can_review" do
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
let(:payload) { serializer.as_json }
|
||||
|
|
Loading…
Reference in New Issue