Initial implementation completion and refactor (#6806)

This commit is contained in:
Jeremy Letto
2026-04-11 23:51:10 -04:00
committed by GitHub
parent 2e10b2f5d5
commit 8cc65b8967
76 changed files with 897 additions and 890 deletions
@@ -1,26 +1,10 @@
import webClient from '../../WebClient';
import { BackendService } from '../../services/BackendService';
import { AdminPersistence } from '../../persistence';
export function adjustMod(userName: string, shouldBeMod?: boolean, shouldBeJudge?: boolean): void {
const command = webClient.protobuf.controller.Command_AdjustMod.create({ userName, shouldBeMod, shouldBeJudge });
const sc = webClient.protobuf.controller.AdminCommand.create({ '.Command_AdjustMod.ext': command });
webClient.protobuf.sendAdminCommand(sc, (raw) => {
const { responseCode } = raw;
let error: string;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
AdminPersistence.adjustMod(userName, shouldBeMod, shouldBeJudge);
return;
default:
error = 'Failed to reload config.';
break;
}
if (error) {
console.error(responseCode, error);
}
BackendService.sendAdminCommand('Command_AdjustMod', { userName, shouldBeMod, shouldBeJudge }, {
onSuccess: () => {
AdminPersistence.adjustMod(userName, shouldBeMod, shouldBeJudge);
},
});
}