mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #3854 from tgxworld/fix_transactional_race_condition
FIX: Race condition when wrapping `PostCreator#create` in a transaction.
This commit is contained in:
@@ -516,6 +516,22 @@ describe PostAction do
|
||||
topic.reload
|
||||
expect(topic.posts.count).to eq(1)
|
||||
end
|
||||
|
||||
it "should create a notification in the related topic" do
|
||||
post = Fabricate(:post)
|
||||
user = Fabricate(:user)
|
||||
action = PostAction.act(user, post, PostActionType.types[:spam], message: "WAT")
|
||||
topic = action.reload.related_post.topic
|
||||
expect(user.notifications.count).to eq(0)
|
||||
|
||||
SiteSetting.expects(:auto_respond_to_flag_actions).returns(true)
|
||||
PostAction.agree_flags!(post, admin)
|
||||
|
||||
user_notifications = user.notifications
|
||||
expect(user_notifications.count).to eq(1)
|
||||
expect(user_notifications.last.topic).to eq(topic)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "rate limiting" do
|
||||
|
||||
Reference in New Issue
Block a user