mirror of
https://github.com/discourse/discourse.git
synced 2025-01-11 02:54:38 +08:00
187b0bfb43
* FEATURE: Show similar users when penalizing a user Moderators will be notified if other users with the same IP address exist before penalizing a user. * FEATURE: Allow staff to penalize multiple users This allows staff members to suspend or silence multiple users belonging to the same person.
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
import Controller from "@ember/controller";
|
|
import PenaltyController from "admin/mixins/penalty-controller";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import { isEmpty } from "@ember/utils";
|
|
|
|
export default Controller.extend(PenaltyController, {
|
|
suspendUntil: null,
|
|
suspending: false,
|
|
|
|
onShow() {
|
|
this.resetModal();
|
|
this.setProperties({
|
|
suspendUntil: null,
|
|
suspending: false,
|
|
otherUserIds: [],
|
|
});
|
|
},
|
|
|
|
finishedSetup() {
|
|
this.set("suspendUntil", this.user?.next_penalty);
|
|
},
|
|
|
|
@discourseComputed("suspendUntil", "reason", "suspending")
|
|
submitDisabled(suspendUntil, reason, suspending) {
|
|
return suspending || isEmpty(suspendUntil) || !reason || reason.length < 1;
|
|
},
|
|
|
|
actions: {
|
|
suspend() {
|
|
if (this.submitDisabled) {
|
|
return;
|
|
}
|
|
|
|
this.set("suspending", true);
|
|
this.penalize(() => {
|
|
return this.user.suspend({
|
|
suspend_until: this.suspendUntil,
|
|
reason: this.reason,
|
|
message: this.message,
|
|
post_id: this.postId,
|
|
post_action: this.postAction,
|
|
post_edit: this.postEdit,
|
|
other_user_ids: this.otherUserIds,
|
|
});
|
|
}).finally(() => this.set("suspending", false));
|
|
},
|
|
},
|
|
});
|