From 2c4ada6c7d6bedf0544ac31e9529ddbcc42a8bc4 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 14 Apr 2014 15:10:32 -0400 Subject: [PATCH] FIX: give an accurate reason why a user's posts can be deleted from admin --- app/assets/javascripts/admin/models/admin_user.js | 6 +++++- config/locales/client.en.yml | 7 +++++-- config/site_settings.yml | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index 493ec58d19f..4f186829a05 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -38,7 +38,11 @@ Discourse.AdminUser = Discourse.User.extend({ deleteAllPostsExplanation: function() { if (!this.get('can_delete_all_posts')) { - return I18n.t('admin.user.cant_delete_all_posts', {count: Discourse.SiteSettings.delete_user_max_post_age}); + 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 { + return I18n.t('admin.user.cant_delete_all_posts', {count: Discourse.SiteSettings.delete_user_max_post_age}); + } } else { return null; } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 044d2b17472..0820df06c56 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1631,8 +1631,11 @@ en: 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.)" cant_delete_all_posts: - one: "Can't delete all posts. Some posts are older than %{count} day old." - other: "Can't delete all posts. Some posts are older than %{count} days old." + one: "Can't delete all posts. Some posts are older than %{count} day old. (The delete_user_max_post_age setting.)" + other: "Can't delete all posts. Some posts are older than %{count} days old. (The delete_user_max_post_age setting.)" + cant_delete_all_too_many_posts: + one: "Can't delete all posts because the user has more than 1 post. (The delete_all_posts_max setting.)" + other: "Can't delete all posts because the user has more than %{count} posts. (The delete_all_posts_max setting.)" delete_confirm: "Are you SURE you want to delete this user? This action is permanent!" delete_and_block: "Yes, and block future signups from this email and IP address" delete_dont_block: "Yes, just delete the user" diff --git a/config/site_settings.yml b/config/site_settings.yml index d4a2d0e6f03..49c024f53d9 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -155,7 +155,9 @@ users: delete_user_max_post_age: client: true default: 60 - delete_all_posts_max: 15 + delete_all_posts_max: + client: true + default: 15 redirect_users_to_top_page: true posting: