Merge pull request #2056 from vikhyat/pm-likes

Don't suppress like notifications in private messages
This commit is contained in:
Régis Hanol 2014-03-06 14:53:27 +01:00
commit 11d91328ab
2 changed files with 13 additions and 2 deletions

View File

@ -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],

View File

@ -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