Capture team chat and expose moderation match archives
This commit is contained in:
@@ -10,6 +10,7 @@ export interface MatchHistoryQuery {
|
||||
sort: MatchSort;
|
||||
direction: 'asc' | 'desc';
|
||||
page: number;
|
||||
archive: boolean;
|
||||
}
|
||||
export const matchQueryKeys = [
|
||||
'game',
|
||||
@@ -19,7 +20,8 @@ export const matchQueryKeys = [
|
||||
'status',
|
||||
'sort',
|
||||
'direction',
|
||||
'page'
|
||||
'page',
|
||||
'archive'
|
||||
] as const;
|
||||
export function readMatchQuery(params: URLSearchParams): MatchHistoryQuery {
|
||||
const game = params.get('game') ?? '';
|
||||
@@ -30,6 +32,7 @@ export function readMatchQuery(params: URLSearchParams): MatchHistoryQuery {
|
||||
const sort = params.get('sort') || 'started';
|
||||
const direction = params.get('direction') || 'desc';
|
||||
const page = Number(params.get('page') || 1);
|
||||
const archive = params.get('archive') ?? '';
|
||||
if (
|
||||
!['', 't5', 't6'].includes(game) ||
|
||||
map.length > 1024 ||
|
||||
@@ -40,7 +43,8 @@ export function readMatchQuery(params: URLSearchParams): MatchHistoryQuery {
|
||||
!['asc', 'desc'].includes(direction) ||
|
||||
!Number.isSafeInteger(page) ||
|
||||
page < 1 ||
|
||||
page > 1000000
|
||||
page > 1000000 ||
|
||||
!['', '0', '1'].includes(archive)
|
||||
)
|
||||
throw new Error('Invalid match history filters.');
|
||||
return {
|
||||
@@ -51,7 +55,8 @@ export function readMatchQuery(params: URLSearchParams): MatchHistoryQuery {
|
||||
status: status as MatchHistoryQuery['status'],
|
||||
sort: sort as MatchSort,
|
||||
direction: direction as 'asc' | 'desc',
|
||||
page
|
||||
page,
|
||||
archive: archive === '1'
|
||||
};
|
||||
}
|
||||
/** Namespaced filters also work inside an instance's Matches tab. */
|
||||
|
||||
Reference in New Issue
Block a user