posts: fix double deletion bug.
Fix a bug where, if a user a was deleting a post and they accidentally clicked the delete button twice, it could create two flags.
This commit is contained in:
@@ -789,7 +789,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def delete!(reason, move_favorites: false, user: CurrentUser.user)
|
||||
transaction do
|
||||
with_lock do
|
||||
automated = (user == User.system)
|
||||
|
||||
flags.pending.update!(status: :succeeded)
|
||||
|
||||
Reference in New Issue
Block a user