From e660e25616e9f51776d54009586ffeb8fed2b242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 21 Dec 2021 11:24:05 +0100 Subject: [PATCH] Fixing new MapDetails type guard It was working improperly with messages from the admin --- messages/JsonMessages/MapDetailsData.ts | 6 +++--- pusher/src/Controller/MapController.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/messages/JsonMessages/MapDetailsData.ts b/messages/JsonMessages/MapDetailsData.ts index ff18acc3..794c9bac 100644 --- a/messages/JsonMessages/MapDetailsData.ts +++ b/messages/JsonMessages/MapDetailsData.ts @@ -9,13 +9,13 @@ import { isNumber } from "generic-type-guard"; export const isMapDetailsData = new tg.IsInterface() .withProperties({ - roomSlug: tg.isOptional(tg.isString), // deprecated mapUrl: tg.isString, policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes), tags: tg.isArray(tg.isString), textures: tg.isArray(isCharacterTexture), - contactPage: tg.isUnion(tg.isString, tg.isUndefined), - authenticationMandatory: tg.isUnion(tg.isBoolean, tg.isUndefined), + authenticationMandatory: tg.isUnion(tg.isNullable(tg.isBoolean), tg.isUndefined), + roomSlug: tg.isNullable(tg.isString), // deprecated + contactPage: tg.isNullable(tg.isString), group: tg.isNullable(tg.isString), }) .withOptionalProperties({ diff --git a/pusher/src/Controller/MapController.ts b/pusher/src/Controller/MapController.ts index 3277bd84..00936b44 100644 --- a/pusher/src/Controller/MapController.ts +++ b/pusher/src/Controller/MapController.ts @@ -59,11 +59,11 @@ export class MapController extends BaseController { JSON.stringify({ mapUrl, policy_type: GameRoomPolicyTypes.ANONYMOUS_POLICY, - roomSlug: "", // Deprecated + roomSlug: null, // Deprecated group: null, tags: [], textures: [], - contactPage: undefined, + contactPage: null, authenticationMandatory: DISABLE_ANONYMOUS, } as MapDetailsData) );