diff --git a/app/models/post_alert_observer.rb b/app/models/post_alert_observer.rb index 0b6b4beff86..3413c3ce735 100644 --- a/app/models/post_alert_observer.rb +++ b/app/models/post_alert_observer.rb @@ -37,7 +37,6 @@ class PostAlertObserver < ActiveRecord::Observer post = post_action.post return if post_action.user.blank? - return if post.topic.private_message? create_notification(post.user, Notification.types[:liked], diff --git a/spec/models/post_alert_observer_spec.rb b/spec/models/post_alert_observer_spec.rb index bdb6fc3f5e0..93bddb0d719 100644 --- a/spec/models/post_alert_observer_spec.rb +++ b/spec/models/post_alert_observer_spec.rb @@ -96,7 +96,11 @@ describe PostAlertObserver do context 'private message' do let(:user) { Fabricate(:user) } let(:mention_post) { Fabricate(:post, user: user, raw: 'Hello @eviltrout')} - let(:topic) { mention_post.topic } + let(:topic) do + topic = mention_post.topic + topic.update_column :archetype, Archetype.private_message + topic + end it "won't notify someone who can't see the post" do lambda { @@ -104,6 +108,14 @@ describe PostAlertObserver do mention_post }.should_not change(evil_trout.notifications, :count) end + + it 'creates like notifications' do + other_user = Fabricate(:user) + topic.allowed_users << user << other_user + lambda { + PostAction.act(other_user, mention_post, PostActionType.types[:like]) + }.should change(user.notifications, :count) + end end context 'moderator action post' do