UBER-438: Use tracker as default for new users/workspaces (#3403)

This commit is contained in:
Andrey Sobolev
2023-06-09 00:42:00 +07:00
committed by GitHub
parent 3644892579
commit 3d06e44517
7 changed files with 57 additions and 13 deletions
@@ -273,11 +273,38 @@
let space = loc.path[3] as Ref<Space>
let special = loc.path[4]
const fragment = loc.fragment
let navigateDone = false
if (app === undefined) {
const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`)
if (last != null) {
navigate(JSON.parse(last))
const lastValue = JSON.parse(last)
navigateDone = navigate(lastValue)
if (navigateDone) {
return
}
}
if (app === undefined && !navigateDone) {
const appShort = getMetadata(workbench.metadata.DefaultApplication) as Ref<Application>
const spaceRef = getMetadata(workbench.metadata.DefaultSpace) as Ref<Space>
const specialRef = getMetadata(workbench.metadata.DefaultSpecial) as Ref<Space>
const loc = getCurrentLocation()
// Be sure URI is not yet changed
if (loc.path[2] === undefined) {
loc.path[2] = appShort
let len = 3
if (spaceRef !== undefined && specialRef !== undefined) {
const spaceObj = await client.findOne(core.class.Space, { _id: spaceRef })
if (spaceObj !== undefined) {
loc.path[3] = spaceRef
loc.path[4] = specialRef
len = 5
}
}
loc.path.length = len
if (navigate(loc)) {
return
}
}
}
}