2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-10-03 17:21:20 +08:00

DEV: Ensure taking actions on users from a posts creates a reviewable

This commit is contained in:
Ted Johansson 2025-09-26 16:05:09 +08:00
parent 08a741b817
commit 50c30c39f3
No known key found for this signature in database
GPG key ID: 2E801F82D9A4C6E9
2 changed files with 14 additions and 2 deletions

View file

@ -100,14 +100,25 @@ export default class PenalizeUser extends Component {

if (this.args.model.penaltyType === "suspend") {
opts.suspend_until = this.penalizeUntil;
result = await this.args.model.user.suspend(opts);

if (this.args.confirmCallback) {
result = await this.args.confirmCallback(opts);
} else {
result = await this.args.model.user.suspend(opts);
}
} else if (this.args.model.penaltyType === "silence") {
opts.silenced_till = this.penalizeUntil;
result = await this.args.model.user.silence(opts);

if (this.args.confirmCallback) {
result = await this.args.confirmCallback(opts);
} else {
result = await this.args.model.user.silence(opts);
}
} else {
// eslint-disable-next-line no-console
console.error("Unknown penalty type:", this.args.model.penaltyType);
}

this.args.closeModal({ success: true });
if (this.successCallback) {
await this.successCallback(result);

View file

@ -52,6 +52,7 @@ export default class AdminToolsService extends Service {
user: loadedUser,
before: opts.before,
successCallback: opts.successCallback,
confirmCallback: opts.confirmCallback,
},
});
}