BUGFIXES: properly deal with bookmarks and deleted posts

BUGFIX: removing a bookmark from the activity feed was busted for deleted posts
BUGFIX: delete associated user actions when deleting a post
This commit is contained in:
Régis Hanol
2014-06-04 17:41:11 +02:00
parent 72abb6e274
commit 0df666277d
12 changed files with 69 additions and 47 deletions
+1 -9
View File
@@ -288,13 +288,10 @@ describe PostsController do
let(:post) { Fabricate(:post, user: log_in) }
it "raises an error if the user doesn't have permission to see the post" do
Guardian.any_instance.expects(:can_see?).with(post).returns(false).twice
Guardian.any_instance.expects(:can_see?).with(post).returns(false).once
xhr :put, :bookmark, post_id: post.id, bookmarked: 'true'
response.should be_forbidden
xhr :put, :remove_bookmark_by_number, topic_id: post.topic_id, post_number: post.post_number
response.should be_forbidden
end
it 'creates a bookmark' do
@@ -307,11 +304,6 @@ describe PostsController do
xhr :put, :bookmark, post_id: post.id
end
it 'removes a bookmark using the topic_id and the post_number' do
PostAction.expects(:remove_act).with(post.user, post, PostActionType.types[:bookmark])
xhr :put, :remove_bookmark_by_number, topic_id: post.topic_id, post_number: post.post_number
end
end
end