mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: auto read message on notification click
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
import ReactFiber from "../ReactFiber";
|
import ReactFiber from "../ReactFiber";
|
||||||
|
import { delay } from "../delay";
|
||||||
|
|
||||||
const handleNotificationClick = async (target: HTMLElement) => {
|
const handleNotificationClick = async (target: HTMLElement) => {
|
||||||
const notificationItem = target.closest(
|
const notificationItem = target.closest(
|
||||||
@@ -33,6 +34,24 @@ const handleNotificationClick = async (target: HTMLElement) => {
|
|||||||
'[class*="notifications__notifications___"] > button',
|
'[class*="notifications__notifications___"] > button',
|
||||||
) as HTMLButtonElement | null;
|
) as HTMLButtonElement | null;
|
||||||
notificationButton?.click();
|
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 = [
|
const clickListeners = [
|
||||||
|
|||||||
Reference in New Issue
Block a user