fix: auto read message on notification click

This commit is contained in:
SethBurkart123
2025-07-02 06:39:40 +10:00
parent 43a780de8e
commit ad0a329331
@@ -1,5 +1,6 @@
import { waitForElm } from "@/seqta/utils/waitForElm";
import ReactFiber from "../ReactFiber";
import { delay } from "../delay";
const handleNotificationClick = async (target: HTMLElement) => {
const notificationItem = target.closest(
@@ -33,6 +34,24 @@ const handleNotificationClick = async (target: HTMLElement) => {
'[class*="notifications__notifications___"] > button',
) as HTMLButtonElement | null;
notificationButton?.click();
await delay(10);
const button = document.querySelector('[class*="MessageList__selected___"]');
if (button) {
(button as HTMLElement).click();
}
// send a network request to mark as read
fetch('/seqta/student/save/message', {
method: "POST",
credentials: "include",
body: JSON.stringify({
items: [matchingNotification.message.messageID],
mode: 'x-read',
read: true,
}),
});
};
const clickListeners = [