FEATURE: Add setting to disable notifications for topic category edits (#14632)

This commit is contained in:
Jean
2021-10-18 09:04:01 -04:00
committed by GitHub
parent fb5a062b1f
commit 6275658e3d
6 changed files with 39 additions and 1 deletions

View File

@@ -1529,6 +1529,7 @@ describe Topic do
fab!(:category) { Fabricate(:category_with_definition, user: user) }
describe 'without a previous category' do
it 'changes the category' do
topic.change_category_to_id(category.id)
category.reload
@@ -1620,6 +1621,16 @@ describe Topic do
).exists?).to eq(true)
end
it 'should not generate a notification if SiteSetting.disable_category_edit_notifications is enabled' do
SiteSetting.disable_category_edit_notifications = true
expect do
topic.change_category_to_id(new_category.id)
end.to change { Notification.count }.by(0)
expect(topic.category_id).to eq(new_category.id)
end
it 'should generate the modified notification for the topic if already seen' do
TopicUser.create!(
topic_id: topic.id,