From 76a250300a04b7939ac9d3b12c5b7f02b4dc5b9d Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 20 Jan 2014 17:53:30 +1100 Subject: [PATCH] BUGFIX: filter by topic --- app/models/post_alert_observer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/post_alert_observer.rb b/app/models/post_alert_observer.rb index 1d660ff7eaa..838d8281edb 100644 --- a/app/models/post_alert_observer.rb +++ b/app/models/post_alert_observer.rb @@ -64,7 +64,7 @@ class PostAlertObserver < ActiveRecord::Observer next if user.blank? destroy_notifications(user, Notification.types[:private_message], post.topic) - unread_post = first_unread_post(user,post.topic) + unread_post = first_unread_post(user,post.topic) || post create_notification(user, Notification.types[:private_message], unread_post) end elsif post.post_type != Post.types[:moderator_action] @@ -84,6 +84,7 @@ class PostAlertObserver < ActiveRecord::Observer SELECT last_read_post_number FROM topic_users tu WHERE tu.user_id = ? AND tu.topic_id = ? ),0)', user.id, topic.id) + .where(topic_id: topic.id) .order('post_number').first end