From c02273eb8bd0ba94623f90309c442fe2a25bd5dc Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Mon, 16 Mar 2020 09:51:28 -0300 Subject: [PATCH] FIX: Use delete_all_posts_max to improve consistency when using the delete button from the admin view (#9194) --- app/assets/javascripts/admin/controllers/admin-user-index.js | 3 ++- app/assets/javascripts/discourse/models/user.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js b/app/assets/javascripts/admin/controllers/admin-user-index.js index 0460c314c75..7bd7abe341b 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js @@ -199,7 +199,8 @@ export default Controller.extend(CanCheckEmails, { destroy() { const postCount = this.get("model.post_count"); - if (postCount <= 5) { + const maxPostCount = this.siteSettings.delete_all_posts_max; + if (postCount <= maxPostCount) { return this.model.destroy({ deletePosts: true }); } else { return this.model.destroy(); diff --git a/app/assets/javascripts/discourse/models/user.js b/app/assets/javascripts/discourse/models/user.js index a7d9ce8b294..421376609a3 100644 --- a/app/assets/javascripts/discourse/models/user.js +++ b/app/assets/javascripts/discourse/models/user.js @@ -45,7 +45,8 @@ const User = RestModel.extend({ @discourseComputed("can_be_deleted", "post_count") canBeDeleted(canBeDeleted, postCount) { - return canBeDeleted && postCount <= 5; + const maxPostCount = Discourse.SiteSettings.delete_all_posts_max; + return canBeDeleted && postCount <= maxPostCount; }, @discourseComputed()