FIX: Use delete_all_posts_max to improve consistency when using the delete button from the admin view (#9194)

This commit is contained in:
Roman Rizzi 2020-03-16 09:51:28 -03:00 committed by GitHub
parent ce50695bff
commit c02273eb8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -199,7 +199,8 @@ export default Controller.extend(CanCheckEmails, {
destroy() { destroy() {
const postCount = this.get("model.post_count"); 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 }); return this.model.destroy({ deletePosts: true });
} else { } else {
return this.model.destroy(); return this.model.destroy();

View File

@ -45,7 +45,8 @@ const User = RestModel.extend({
@discourseComputed("can_be_deleted", "post_count") @discourseComputed("can_be_deleted", "post_count")
canBeDeleted(canBeDeleted, postCount) { canBeDeleted(canBeDeleted, postCount) {
return canBeDeleted && postCount <= 5; const maxPostCount = Discourse.SiteSettings.delete_all_posts_max;
return canBeDeleted && postCount <= maxPostCount;
}, },
@discourseComputed() @discourseComputed()