mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:03:18 +08:00
Avoid calling can_delete_account twice
This commit is contained in:
parent
feb4fa3bb5
commit
42fb9d4fb1
|
@ -56,11 +56,11 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
end
|
||||
|
||||
def include_can_delete_account?
|
||||
can_delete_account
|
||||
end
|
||||
|
||||
def can_delete_account
|
||||
scope.can_delete_user?(object)
|
||||
end
|
||||
|
||||
def can_delete_account
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ class UserDestroyer
|
|||
end
|
||||
end
|
||||
end
|
||||
x = PostDestroyer.new(@actor.staff? ? @actor : Discourse.system_user, post).destroy
|
||||
PostDestroyer.new(@actor.staff? ? @actor : Discourse.system_user, post).destroy
|
||||
if post.topic and post.post_number == 1
|
||||
Topic.unscoped.where(id: post.topic.id).update_all(user_id: nil)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user