Skip to content

Commit

Permalink
wip: fix type in playerDatabase.registerAction
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Oct 18, 2023
1 parent 7731ecb commit 3dc54e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion core/extras/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const calcExpirationFromDuration = (inputDuration: string) => {
let expiration;
let duration;
if (inputDuration === 'permanent') {
expiration = false;
expiration = false as const;
} else {
const [multiplierInput, unit] = inputDuration.split(/\s+/);
const multiplier = parseInt(multiplierInput);
Expand Down
10 changes: 8 additions & 2 deletions core/webroutes/databaseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ async function handleBandIds(ctx: AuthedCtx): Promise<GenericApiResp> {
//Register action
let actionId;
try {
//FIXME: this type has some issue
actionId = ctx.txAdmin.playerDatabase.registerAction(identifiers, 'ban', ctx.admin.name, reason, expiration, false);
actionId = ctx.txAdmin.playerDatabase.registerAction(
identifiers,
'ban',
ctx.admin.name,
reason,
expiration,
false
);
} catch (error) {
return { error: `Failed to ban identifiers: ${(error as Error).message}` };
}
Expand Down
2 changes: 1 addition & 1 deletion core/webroutes/player/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async function handleBan(ctx: AuthedCtx, player: PlayerClass): Promise<GenericAp
expiration,
player.displayName,
allHwids
); //FIXME: expiration
);
} catch (error) {
return { error: `Failed to ban player: ${(error as Error).message}` };
}
Expand Down
16 changes: 1 addition & 15 deletions docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Processo:
- [x] aplicar novo tipo e trocar todos os ctx.session e ctx.utils.xxxxx de todas as rotas
- [x] remove all `globals.` in the webroutes folder from typescript files
- [x] test and commit all changed files
- [ ] check `playerDatabase.registerAction` expiration type error
- [x] check `playerDatabase.registerAction` expiration type error
- [ ] translation fix the `The player was xxxxx` lines in all files
- [ ] renomear csrfToken e forumUsername pra snake case, mas no AuthedAdmin pode ficar tudo como camel
- sim, colocar o csrfToken pra dentro do admin, e tb editar o preAuth
Expand All @@ -21,20 +21,6 @@ Processo:
- [ ] escrever teste automatizado pros authMiddlewares e authLogic


Ainda preciso do shared/sessionTypes.ts ?


Retest:
- auth legacy
- auth auth intercom
- auth admin (menu opens?)
- razão de não abrir o menu, admin_not_found
- auth of old menu /nui/ get/action routes (player info, revoke action, ban)
- menu iframe, iframe start
- auth socketio



=======================================================================

### v7 Menus:
Expand Down

0 comments on commit 3dc54e7

Please sign in to comment.