diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb index bee43627766..adc459419bd 100644 --- a/app/serializers/current_user_serializer.rb +++ b/app/serializers/current_user_serializer.rb @@ -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, diff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rb index bcbe20c13eb..27614aecd70 100644 --- a/spec/serializers/current_user_serializer_spec.rb +++ b/spec/serializers/current_user_serializer_spec.rb @@ -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 }