mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 01:15:00 +08:00
419d71abcb
This commit allows admin to delete all posts by a user irrespective of site settings `delete_user_max_post_age` and `delete_all_posts_max`.
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import Controller, { inject as controller } from "@ember/controller";
|
|
import I18n from "I18n";
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
import { action } from "@ember/object";
|
|
import { alias } from "@ember/object/computed";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
export default Controller.extend(ModalFunctionality, {
|
|
adminUserIndex: controller(),
|
|
username: alias("model.username"),
|
|
postCount: alias("model.post_count"),
|
|
|
|
onShow() {
|
|
this.set("value", null);
|
|
},
|
|
|
|
@discourseComputed("username", "postCount")
|
|
text(username, postCount) {
|
|
return I18n.t(`admin.user.delete_posts.confirmation.text`, {
|
|
username,
|
|
postCount,
|
|
});
|
|
},
|
|
|
|
@discourseComputed("username")
|
|
deleteButtonText(username) {
|
|
return I18n.t(`admin.user.delete_posts.confirmation.delete`, {
|
|
username,
|
|
});
|
|
},
|
|
|
|
@discourseComputed("value", "text")
|
|
deleteDisabled(value, text) {
|
|
return !value || text !== value;
|
|
},
|
|
|
|
@action
|
|
confirm() {
|
|
this.adminUserIndex.send("deleteAllPosts");
|
|
},
|
|
|
|
@action
|
|
close() {
|
|
this.send("closeModal");
|
|
},
|
|
});
|