From e76a805c8f47bb5a956c90465d27bd9f4c9adfa8 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Thu, 17 Feb 2022 14:08:53 -0800 Subject: [PATCH] Better logging of to device events / usernames --- src/room/GroupCallInspector.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/room/GroupCallInspector.jsx b/src/room/GroupCallInspector.jsx index 062b3ce9..b7b03d44 100644 --- a/src/room/GroupCallInspector.jsx +++ b/src/room/GroupCallInspector.jsx @@ -59,8 +59,8 @@ function getUserName(userId) { const match = userId.match(/@([^\:]+):/); return match && match.length > 0 - ? match[1].replace("-", " ").replace("W", "") - : userId.replace("W", ""); + ? match[1].replace("-", " ").replace(/\W/g, "") + : userId.replace(/\W/g, ""); } function formatContent(type, content) { @@ -231,7 +231,7 @@ function reducer(state, action) { ), }; } - case "receive_to_device_event": { + case "received_voip_event": { const event = action.event; const eventsByUserId = { ...state.eventsByUserId }; const fromId = event.getSender(); @@ -338,8 +338,8 @@ function useGroupCallState(client, groupCall, pollCallStats) { // dispatch({ type: "call_hangup", call }); // } - function onToDeviceEvent(event) { - dispatch({ type: "receive_to_device_event", event }); + function onReceivedVoipEvent(event) { + dispatch({ type: "received_voip_event", event }); } function onSendVoipEvent(event) { @@ -351,7 +351,7 @@ function useGroupCallState(client, groupCall, pollCallStats) { groupCall.on("send_voip_event", onSendVoipEvent); //client.on("state", onCallsChanged); //client.on("hangup", onCallHangup); - client.on("toDeviceEvent", onToDeviceEvent); + client.on("received_voip_event", onReceivedVoipEvent); onUpdateRoomState(); @@ -361,7 +361,7 @@ function useGroupCallState(client, groupCall, pollCallStats) { groupCall.removeListener("send_voip_event", onSendVoipEvent); //client.removeListener("state", onCallsChanged); //client.removeListener("hangup", onCallHangup); - client.removeListener("toDeviceEvent", onToDeviceEvent); + client.removeListener("received_voip_event", onReceivedVoipEvent); }; }, [client, groupCall]);