mirror of
https://github.com/discourse/discourse.git
synced 2025-06-22 19:43:53 +08:00
FIX: Show error message if user is already silenced or suspended (#10988)
Users could be silenced or suspended by two staff members at the same time and would not be aware of it. This commit shows an error message if another penalty has been applied.
This commit is contained in:
@ -352,28 +352,17 @@ const AdminUser = User.extend({
|
||||
type: "PUT",
|
||||
})
|
||||
.then((result) => this.setProperties(result.unsilence))
|
||||
.catch((e) => {
|
||||
const error = I18n.t("admin.user.unsilence_failed", {
|
||||
error: this._formatError(e),
|
||||
});
|
||||
bootbox.alert(error);
|
||||
})
|
||||
.finally(() => this.set("silencingUser", false));
|
||||
},
|
||||
|
||||
silence(data) {
|
||||
this.set("silencingUser", true);
|
||||
|
||||
return ajax(`/admin/users/${this.id}/silence`, {
|
||||
type: "PUT",
|
||||
data,
|
||||
})
|
||||
.then((result) => this.setProperties(result.silence))
|
||||
.catch((e) => {
|
||||
const error = I18n.t("admin.user.silence_failed", {
|
||||
error: this._formatError(e),
|
||||
});
|
||||
bootbox.alert(error);
|
||||
})
|
||||
.finally(() => this.set("silencingUser", false));
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user