diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb index d0b53713d..1dda39f08 100644 --- a/app/services/post_alerter.rb +++ b/app/services/post_alerter.rb @@ -144,7 +144,7 @@ class PostAlerter end def extract_linked_users(post) - post.topic_links.map do |link| + post.topic_links.where(reflection: false).map do |link| linked_post = link.link_post if !linked_post && topic = link.link_topic linked_post = topic.posts(post_number: 1).first diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb index 77d5bda8a..2e581eeff 100644 --- a/spec/services/post_alerter_spec.rb +++ b/spec/services/post_alerter_spec.rb @@ -44,6 +44,11 @@ describe PostAlerter do user.reload user.notifications.count.should == 1 + + # don't notify on reflection + post1.reload + PostAlerter.new.extract_linked_users(post1).length.should == 0 + end end