mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:12:45 +08:00
FIX: Don't alert on new posts in a topic unless it's a new record
This commit is contained in:
parent
8141e1d9bc
commit
09be741820
|
@ -108,7 +108,7 @@ class PostAlerter
|
|||
|
||||
sync_group_mentions(post, mentioned_groups)
|
||||
|
||||
if post.post_number == 1
|
||||
if new_record && post.post_number == 1
|
||||
topic = post.topic
|
||||
|
||||
if topic.present?
|
||||
|
|
|
@ -342,10 +342,17 @@ describe PostAlerter do
|
|||
it "notifies the user who is following the first post category" do
|
||||
level = CategoryUser.notification_levels[:watching_first_post]
|
||||
CategoryUser.set_notification_level_for_category(user, level, category.id)
|
||||
PostAlerter.post_created(post)
|
||||
PostAlerter.new.after_save_post(post, true)
|
||||
expect(user.notifications.where(notification_type: Notification.types[:watching_first_post]).count).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't notify when the record is not new" do
|
||||
level = CategoryUser.notification_levels[:watching_first_post]
|
||||
CategoryUser.set_notification_level_for_category(user, level, category.id)
|
||||
PostAlerter.new.after_save_post(post, false)
|
||||
expect(user.notifications.where(notification_type: Notification.types[:watching_first_post]).count).to eq(0)
|
||||
end
|
||||
|
||||
it "notifies the user who is following the first post tag" do
|
||||
level = TagUser.notification_levels[:watching_first_post]
|
||||
TagUser.change(user.id, tag.id, level)
|
||||
|
|
Loading…
Reference in New Issue
Block a user