DEV: Remove enable_whispers site setting (#19196)

* DEV: Remove enable_whispers site setting

Whispers are enabled as long as there is at least one group allowed to
whisper, see whispers_allowed_groups site setting.

* DEV: Always enable whispers for admins if at least one group is allowed.
This commit is contained in:
Bianca Nenciu
2022-12-16 18:42:51 +02:00
committed by GitHub
parent 947711ae15
commit b80765f1f4
33 changed files with 89 additions and 76 deletions

View File

@ -2920,24 +2920,21 @@ RSpec.describe User do
end
describe "#whisperer?" do
before do
SiteSetting.enable_whispers = true
end
fab!(:group) { Fabricate(:group) }
it 'returns true for an admin user' do
SiteSetting.whispers_allowed_groups = "#{group.id}"
admin = Fabricate.create(:admin)
expect(admin.whisperer?).to eq(true)
end
it 'returns false for an admin user when whispers are not enabled' do
SiteSetting.enable_whispers = false
admin = Fabricate.create(:admin)
expect(admin.whisperer?).to eq(false)
end
it 'returns true for user belonging to whisperers groups' do
group = Fabricate(:group)
whisperer = Fabricate(:user)
user = Fabricate(:user)
SiteSetting.whispers_allowed_groups = "#{group.id}"
@ -2950,6 +2947,10 @@ RSpec.describe User do
expect(whisperer.whisperer?).to eq(true)
expect(user.whisperer?).to eq(false)
end
it 'returns false if no whispers groups exist' do
expect(subject.whisperer?).to eq(false)
end
end
describe "#grouped_unread_notifications" do