Skip to content

Commit

Permalink
BUGFIX: filter by topic
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jan 20, 2014
1 parent c7c1c93 commit 76a2503
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/post_alert_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def after_create_post(post)
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]
Expand All @@ -84,6 +84,7 @@ def first_unread_post(user, topic)
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

Expand Down

0 comments on commit 76a2503

Please sign in to comment.