Notif
This commit is contained in:
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user