diff --git a/client/js/socket-events/msg.ts b/client/js/socket-events/msg.ts index d962a1eb..0f0e1879 100644 --- a/client/js/socket-events/msg.ts +++ b/client/js/socket-events/msg.ts @@ -123,12 +123,14 @@ function notifyMessage( ) { let title: string; let body: string; + // TODO: fix msg type and get rid of that conditional + const nick = msg.from && msg.from.nick ? msg.from.nick : "unkonown"; if (msg.type === "invite") { title = "New channel invite:"; - body = msg.from.nick + " invited you to " + msg.channel; + body = nick + " invited you to " + msg.channel; } else { - title = String(msg.from.nick); + title = nick; if (channel.type !== "query") { title += ` (${channel.name})`; @@ -138,7 +140,8 @@ function notifyMessage( title += " says:"; } - body = cleanIrcMessage(msg.text); + // TODO: fix msg type and get rid of that conditional + body = cleanIrcMessage(msg.text ? msg.text : ""); } const timestamp = Date.parse(String(msg.time)); diff --git a/shared/types/msg.ts b/shared/types/msg.ts index 7698d08d..a0fc41be 100644 --- a/shared/types/msg.ts +++ b/shared/types/msg.ts @@ -100,4 +100,5 @@ export type SharedMsg = { export type ClientMessage = Omit & { time: Date; users: string[]; + id: number; };