Skip to content

Commit 5e14d38

Browse files
committed
fix(core): legacy bans causing issues on search
1 parent 72b1507 commit 5e14d38

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

core/components/PlayerDatabase/databaseTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type DatabaseActionBaseType = {
2323
author: string;
2424
timestamp: number;
2525
//FIXME: the revocation object itself should be optional instead of nullable properties
26+
//BUT DO REMEMBER THE `'XXX' IN YYY` ISSUE!
2627
revocation: {
2728
timestamp: number | null;
2829
author: string | null;
@@ -35,7 +36,7 @@ export type DatabaseActionBanType = {
3536
} & DatabaseActionBaseType;
3637
export type DatabaseActionWarnType = {
3738
type: 'warn';
38-
expiration: false; //FIXME: remove
39+
expiration: false; //FIXME: remove - BUT DO REMEMBER THE `'XXX' IN YYY` ISSUE!
3940
acked: boolean; //if the player has acknowledged the warning
4041
} & DatabaseActionBaseType;
4142
export type DatabaseActionType = DatabaseActionBanType | DatabaseActionWarnType;

core/components/PlayerDatabase/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ export default class PlayerDatabase {
206206
if (hwidsArray && !Array.isArray(hwidsArray)) throw new Error('hwidsArray should be an array or undefined');
207207
const idsFilter = (action: DatabaseActionType) => idsArray.some((fi) => action.ids.includes(fi))
208208
const hwidsFilter = (action: DatabaseActionType) => {
209-
if (!('hwids' in action)) return false;
210-
const count = hwidsArray!.filter((fi) => action.hwids!.includes(fi)).length
211-
return count >= this.config.requiredBanHwidMatches;
209+
if ('hwids' in action && action.hwids){
210+
const count = hwidsArray!.filter((fi) => action.hwids?.includes(fi)).length;
211+
return count >= this.config.requiredBanHwidMatches;
212+
} else {
213+
return false;
214+
}
212215
}
213216

214217
try {

0 commit comments

Comments
 (0)