From ddbe1c017bbb5140ccec65cb28113b62c23fe83b Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 6 Mar 2015 14:11:48 -0500 Subject: [PATCH] FIX: reason for not being able to delete a staff user's posts was wrong in admin --- app/assets/javascripts/admin/models/admin_user.js | 5 ++++- config/locales/client.en.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index 95643db77..d005c1452 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -57,6 +57,9 @@ Discourse.AdminUser = Discourse.User.extend({ deleteAllPostsExplanation: function() { if (!this.get('can_delete_all_posts')) { + if (this.get('deleteForbidden') && this.get('staff')) { + return I18n.t('admin.user.delete_posts_forbidden_because_staff'); + } if (this.get('post_count') > Discourse.SiteSettings.delete_all_posts_max) { return I18n.t('admin.user.cant_delete_all_too_many_posts', {count: Discourse.SiteSettings.delete_all_posts_max}); } else { @@ -65,7 +68,7 @@ Discourse.AdminUser = Discourse.User.extend({ } else { return null; } - }.property('can_delete_all_posts'), + }.property('can_delete_all_posts', 'deleteForbidden'), deleteAllPosts: function() { var user = this; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 1007f3410..04b0dd324 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2052,6 +2052,7 @@ en: time_read: "Read Time" delete: "Delete User" delete_forbidden_because_staff: "Admins and moderators can't be deleted." + delete_posts_forbidden_because_staff: "Can't delete all posts of admins and moderators." delete_forbidden: one: "Users can't be deleted if they have posts. Delete all posts before trying to delete a user. (Posts older than %{count} day old can't be deleted.)" other: "Users can't be deleted if they have posts. Delete all posts before trying to delete a user. (Posts older than %{count} days old can't be deleted.)"