Merge pull request #10714 from nextcloud/fix/10544/adjust-inactive-session

fix(useActiveSession): adjust behavior of inactive session
This commit is contained in:
Joas Schilling 2023-10-23 07:14:39 +02:00 committed by GitHub
commit 30c4fea183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,7 +98,10 @@ export function useActiveSession() {
try {
await setSessionState(token.value, SESSION.STATE.INACTIVE)
showInfo(t('spreed', 'Session has been marked as inactive'))
// Show toast message only when tab is visible on screen
if (windowIsVisible.value) {
showInfo(t('spreed', 'Session has been marked as inactive'))
}
console.info('Session has been marked as inactive')
} catch (error) {
console.error(error)
@ -112,6 +115,7 @@ export function useActiveSession() {
document.removeEventListener('mouseenter', handleMouseMove)
document.removeEventListener('mouseleave', handleMouseMove)
} else if (type === 'blur') {
clearTimeout(inactiveTimer.value)
inactiveTimer.value = setTimeout(() => {
setSessionAsInactive()
}, INACTIVE_TIME_MS)
@ -123,6 +127,7 @@ export function useActiveSession() {
}
const handleMouseMove = (event) => {
setSessionAsActive()
// Restart timer, if mouse moves around the tab
clearTimeout(inactiveTimer.value)
inactiveTimer.value = setTimeout(() => {