From d23a64d074f54af7bb547aa2548e77f543f796cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 3 Dec 2021 16:07:42 +0100 Subject: [PATCH] Fix sending empty variable message for users that have no right to read variable When a user had no right to read a variable and the variable changed, the user was notified nonetheless with an empty SubMessage, causing an error message in the front: > Uncaught Error: Unexpected batch message type onmessage RoomConnection.ts:181 RoomConnection.ts:181:30 onmessage RoomConnection.ts:181 This fix closes #1613 --- pusher/src/Model/PusherRoom.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pusher/src/Model/PusherRoom.ts b/pusher/src/Model/PusherRoom.ts index 89ed772a..4f616eca 100644 --- a/pusher/src/Model/PusherRoom.ts +++ b/pusher/src/Model/PusherRoom.ts @@ -100,11 +100,11 @@ export class PusherRoom { // Let's dispatch this variable to all the listeners for (const listener of this.listeners) { - const subMessage = new SubMessage(); if (!readableBy || listener.tags.includes(readableBy)) { + const subMessage = new SubMessage(); subMessage.setVariablemessage(variableMessage); + listener.emitInBatch(subMessage); } - listener.emitInBatch(subMessage); } } else if (message.hasErrormessage()) { const errorMessage = message.getErrormessage() as ErrorMessage;