From 48d346173661dfdd2fe9be597bb077cc7ffeea24 Mon Sep 17 00:00:00 2001 From: oobjectt Date: Sat, 10 Dec 2022 22:50:18 +0100 Subject: [PATCH] Update control if guide is in a room --- src/components/guide-tool/GuideToolView.tsx | 27 ++++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/guide-tool/GuideToolView.tsx b/src/components/guide-tool/GuideToolView.tsx index 5e85f46d..5b48820c 100644 --- a/src/components/guide-tool/GuideToolView.tsx +++ b/src/components/guide-tool/GuideToolView.tsx @@ -199,20 +199,23 @@ export const GuideToolView: FC<{}> = props => { const parser = event.getParser(); - const messageGroups = [ ...ongoingMessageGroups ]; - - let lastGroup = messageGroups[messageGroups.length - 1]; - - const guideId = (isOnDuty ? GetSessionDataManager().userId : ongoingUserId); - - if(!lastGroup || lastGroup.userId !== guideId) + if (parser.roomId !== 0) { - lastGroup = new GuideToolMessageGroup(guideId); - messageGroups.push(lastGroup); - } + const messageGroups = [ ...ongoingMessageGroups ]; - lastGroup.addChat(new GuideToolMessage(parser.roomName, parser.roomId)); - setOngoingMessageGroups(messageGroups); + let lastGroup = messageGroups[messageGroups.length - 1]; + + const guideId = (isOnDuty ? GetSessionDataManager().userId : ongoingUserId); + + if(!lastGroup || lastGroup.userId !== guideId) + { + lastGroup = new GuideToolMessageGroup(guideId); + messageGroups.push(lastGroup); + } + + lastGroup.addChat(new GuideToolMessage(parser.roomName, parser.roomId)); + setOngoingMessageGroups(messageGroups); + } }); useMessageEvent(GuideSessionEndedMessageEvent, event =>