mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Don't send notifications for moderator action posts
This commit is contained in:
parent
a08d4e4512
commit
4492d06a9f
2 changed files with 14 additions and 2 deletions
|
@ -63,8 +63,8 @@ class PostAlertObserver < ActiveRecord::Observer
|
||||||
post.topic.all_allowed_users.reject{ |a| a.id == post.user_id }.each do |a|
|
post.topic.all_allowed_users.reject{ |a| a.id == post.user_id }.each do |a|
|
||||||
create_notification(a, Notification.types[:private_message], post)
|
create_notification(a, Notification.types[:private_message], post)
|
||||||
end
|
end
|
||||||
else
|
elsif post.post_type != Post.types[:moderator_action]
|
||||||
# If it's not a private message, notify the users
|
# If it's not a private message and it's not an automatic post caused by a moderator action, notify the users
|
||||||
notify_post_users(post)
|
notify_post_users(post)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,4 +108,16 @@ describe PostAlertObserver do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'moderator action post' do
|
||||||
|
let(:user) { Fabricate(:user) }
|
||||||
|
let(:first_post) { Fabricate(:post, user: user, raw: 'A useless post for you.')}
|
||||||
|
let(:topic) { first_post.topic }
|
||||||
|
|
||||||
|
it 'should not notify anyone' do
|
||||||
|
expect {
|
||||||
|
Fabricate(:post, topic: topic, raw: 'This topic is CLOSED', post_type: Post.types[:moderator_action])
|
||||||
|
}.to_not change { Notification.count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue