FIX: Allow user actions to be saved even if the post has nil user

This issue made it impossible to delete users if they had flagged a post with nil user
This commit is contained in:
David Taylor
2018-08-30 01:03:32 +01:00
parent e6970151a6
commit f0abb4d09a
2 changed files with 11 additions and 2 deletions

View File

@ -477,6 +477,15 @@ describe PostAction do
expect(post.topic.visible).to eq(false)
end
it "doesn't fail when post has nil user" do
post = create_post
post.update!(user: nil)
PostAction.act(codinghorror, post, PostActionType.types[:spam], take_action: true)
post.reload
expect(post.hidden).to eq(true)
end
it "hide tl0 posts that are flagged as spam by a tl3 user" do
newuser = Fabricate(:newuser)
post = create_post(user: newuser)