mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 04:34:13 -06:00
Avoid calling can_delete_account twice
This commit is contained in:
parent
feb4fa3bb5
commit
42fb9d4fb1
@ -56,11 +56,11 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def include_can_delete_account?
|
def include_can_delete_account?
|
||||||
can_delete_account
|
|
||||||
end
|
|
||||||
|
|
||||||
def can_delete_account
|
|
||||||
scope.can_delete_user?(object)
|
scope.can_delete_user?(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_delete_account
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ class UserDestroyer
|
|||||||
end
|
end
|
||||||
end
|
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
|
if post.topic and post.post_number == 1
|
||||||
Topic.unscoped.where(id: post.topic.id).update_all(user_id: nil)
|
Topic.unscoped.where(id: post.topic.id).update_all(user_id: nil)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user