This commit is contained in:
2026-03-11 01:09:12 -04:00
parent dd60be6d2c
commit 064e195f2a
4 changed files with 84 additions and 0 deletions

View File

@@ -13,12 +13,15 @@ import {
updateUser,
getGroupedUsers,
setMyId,
getMyId,
getThreads,
clearData,
users,
setFocused,
setReplyTo,
} from "./data.js";
import { renderChat } from "./render.js";
import { notifyDirectReply } from "./notifications.js";
/**
* Initialize WebSocket connection and wire up event handlers.
@@ -132,6 +135,23 @@ export function initWebSocket(
? null
: String(parent),
});
// Notify when someone else replies directly to one of my root messages.
const myId = getMyId();
const parentId =
parent === null || parent === undefined || parent === "-1"
? null
: String(parent);
if (myId && parentId && author?.id && String(author.id) !== myId) {
const parentMsg = getThreads().get(parentId);
if (
parentMsg &&
parentMsg.parent === null &&
parentMsg.authorId === myId
) {
notifyDirectReply(username, content);
}
}
break;
}
case "msg_ack": {