Skip to content

Commit

Permalink
socket-events/msg: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
brunnre8 committed Apr 8, 2024
1 parent 4cb438c commit 3ef7674
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/js/socket-events/msg.ts
Expand Up @@ -193,7 +193,7 @@ function updateUserList(channel: ClientChan, msg: SharedMsg) {
case "message": // fallthrough

case "action": {
const user = channel.users.find((u) => u.nick === msg.from.nick);
const user = channel.users.find((u) => u.nick === msg.from?.nick);

if (user) {
user.lastMessage = new Date(msg.time).getTime() || Date.now();
Expand All @@ -205,7 +205,7 @@ function updateUserList(channel: ClientChan, msg: SharedMsg) {
case "quit": // fallthrough

case "part": {
const idx = channel.users.findIndex((u) => u.nick === msg.from.nick);
const idx = channel.users.findIndex((u) => u.nick === msg.from?.nick);

if (idx > -1) {
channel.users.splice(idx, 1);
Expand All @@ -215,7 +215,7 @@ function updateUserList(channel: ClientChan, msg: SharedMsg) {
}

case "kick": {
const idx = channel.users.findIndex((u) => u.nick === msg.target.nick);
const idx = channel.users.findIndex((u) => u.nick === msg.target?.nick);

if (idx > -1) {
channel.users.splice(idx, 1);
Expand Down

0 comments on commit 3ef7674

Please sign in to comment.