From 42fb9d4fb17e39ad46073ec73380b1fd1a9157b2 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 13 Feb 2014 15:51:19 -0500 Subject: [PATCH] Avoid calling can_delete_account twice --- app/serializers/current_user_serializer.rb | 8 ++++---- app/services/user_destroyer.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb index ba44f82a740..b215cfa5e8c 100644 --- a/app/serializers/current_user_serializer.rb +++ b/app/serializers/current_user_serializer.rb @@ -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 diff --git a/app/services/user_destroyer.rb b/app/services/user_destroyer.rb index 57eaf20d3dd..9739674c943 100644 --- a/app/services/user_destroyer.rb +++ b/app/services/user_destroyer.rb @@ -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