mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 04:25:03 +02:00
UBERF-9537: Fix Invalid navigate to guest not authorised (#8121)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
closePopup,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
isSameSegments,
|
||||
locationStorageKeyId,
|
||||
locationToUrl,
|
||||
navigate,
|
||||
@@ -58,11 +59,19 @@
|
||||
e.preventDefault()
|
||||
closePopup()
|
||||
closePopup()
|
||||
if (wsUrl !== getCurrentLocation().path[1]) {
|
||||
const last = localStorage.getItem(`${locationStorageKeyId}_${wsUrl}`)
|
||||
if (last !== null) {
|
||||
navigate(JSON.parse(last))
|
||||
} else navigate({ path: [workbenchId, wsUrl] })
|
||||
const current = getCurrentLocation()
|
||||
if (wsUrl !== current.path[1]) {
|
||||
let last: Location | undefined
|
||||
try {
|
||||
last = JSON.parse(localStorage.getItem(`${locationStorageKeyId}_${wsUrl}`) ?? '')
|
||||
} catch (err: any) {
|
||||
// Ignore
|
||||
}
|
||||
if (last != null && isSameSegments(last, current, 2)) {
|
||||
navigate(last)
|
||||
} else {
|
||||
navigate({ path: [workbenchId, wsUrl] })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +157,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="p-2 ml-2 mb-4 select-text flex-col bordered">
|
||||
{decodeTokenPayload(getMetadata(presentation.metadata.Token) ?? '').workspace}
|
||||
{decodeTokenPayload(getMetadata(presentation.metadata.Token) ?? '').workspace ?? ''}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="ap-scroll">
|
||||
|
||||
@@ -78,7 +78,8 @@
|
||||
showPopup,
|
||||
TooltipInstance,
|
||||
workbenchSeparators,
|
||||
resizeObserver
|
||||
resizeObserver,
|
||||
isSameSegments
|
||||
} from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
import {
|
||||
@@ -429,9 +430,12 @@
|
||||
const last = localStorage.getItem(`${locationStorageKeyId}_${loc.path[1]}`)
|
||||
if (last != null) {
|
||||
const lastValue = JSON.parse(last)
|
||||
navigateDone = navigate(lastValue)
|
||||
if (navigateDone) {
|
||||
return
|
||||
|
||||
if (isSameSegments(lastValue, loc, 2)) {
|
||||
navigateDone = navigate(lastValue)
|
||||
if (navigateDone) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (app === undefined && !navigateDone) {
|
||||
|
||||
Reference in New Issue
Block a user