Skip to content

Commit

Permalink
Merge pull request #10714 from nextcloud/fix/10544/adjust-inactive-se…
Browse files Browse the repository at this point in the history
…ssion

fix(useActiveSession): adjust behavior of inactive session
  • Loading branch information
nickvergessen authored Oct 23, 2023
2 parents 38b1ab6 + 331d498 commit 30c4fea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/composables/useActiveSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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(() => {
Expand Down

0 comments on commit 30c4fea

Please sign in to comment.