Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions resources/js/common/sessionSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,16 @@ export const initSessionSync = ({
const markActivity = (source) => {
setSessionState(accountTimeoutLength);
clearWarningState();
setSuppressWarning(2000);
broadcastSessionEvent("activity", { timeout: accountTimeoutLength, source });
sessionDebugLog("activity", { source, timeout: accountTimeoutLength });
const closeSessionModal = resolveCloseSessionModal();
if (closeSessionModal) {
closeSessionModal();
}
if (isLeader()) {
ensureWorkerRunning(`activity:${source}`);
startTimeoutWorker(sessionState.timeout);
}
};

Expand Down Expand Up @@ -499,20 +505,6 @@ export const initSessionSync = ({
broadcastSessionEvent("logout");
});

// Restart the timeout worker (when the user interacts with the page)
const eventsTimeoutWorker = ["click", "keypress"];
eventsTimeoutWorker.forEach((event) => {
document.addEventListener(event, () => {
if (!isLeader()) {
sessionDebugLog("worker:restart:skip", { event });
return;
}
markActivity(event);
sessionDebugLog("worker:restart", { event });
AccountTimeoutWorker.postMessage({ method: "restart" });
});
});

const isSameDevice = (e) => {
const localDeviceId = Vue.$cookies.get(e.device_variable);
const remoteDeviceId = e.device_id;
Expand Down
Loading