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:
parent
08a741b817
commit
50c30c39f3
2 changed files with 14 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -52,6 +52,7 @@ export default class AdminToolsService extends Service {
|
|||
user: loadedUser,
|
||||
before: opts.before,
|
||||
successCallback: opts.successCallback,
|
||||
confirmCallback: opts.confirmCallback,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue