mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
Use transaction around deleting a user and logging that action
This commit is contained in:
parent
f30a74c4f6
commit
56c858e58b
@ -16,10 +16,12 @@ class UserDestroyer
|
||||
def destroy(user)
|
||||
raise Discourse::InvalidParameters.new('user is nil') unless user and user.is_a?(User)
|
||||
raise PostsExistError if user.post_count != 0
|
||||
user.destroy.tap do |u|
|
||||
if u
|
||||
AdminLogger.new(@admin).log_user_deletion(user)
|
||||
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
|
||||
User.transaction do
|
||||
user.destroy.tap do |u|
|
||||
if u
|
||||
AdminLogger.new(@admin).log_user_deletion(user)
|
||||
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user