fix: force using username@server settings if present
parent
d0a4c51ef5
commit
0092c8cbe9
|
@ -357,19 +357,19 @@ export function useUserLocalStorage<T extends object>(key: string, initial: () =
|
||||||
// Backward compatibility, respect webDomain in acct
|
// Backward compatibility, respect webDomain in acct
|
||||||
// In previous versions, acct was username@server instead of username@webDomain
|
// In previous versions, acct was username@server instead of username@webDomain
|
||||||
// for example: elk@m.webtoo.ls instead of elk@webtoo.ls
|
// for example: elk@m.webtoo.ls instead of elk@webtoo.ls
|
||||||
if (!all.value[id]) {
|
// if (!all.value[id]) { // TODO: add back this condition in the future
|
||||||
const [username, webDomain] = id.split('@')
|
const [username, webDomain] = id.split('@')
|
||||||
const server = currentServer.value
|
const server = currentServer.value
|
||||||
if (webDomain && server && server !== webDomain) {
|
if (webDomain && server && server !== webDomain) {
|
||||||
const oldId = `${username}@${server}`
|
const oldId = `${username}@${server}`
|
||||||
const outdatedSettings = all.value[oldId]
|
const outdatedSettings = all.value[oldId]
|
||||||
if (outdatedSettings) {
|
if (outdatedSettings) {
|
||||||
const newAllValue = { ...all.value, [id]: outdatedSettings }
|
const newAllValue = { ...all.value, [id]: outdatedSettings }
|
||||||
delete newAllValue[oldId]
|
delete newAllValue[oldId]
|
||||||
all.value = newAllValue
|
all.value = newAllValue
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
all.value[id] = Object.assign(initial(), all.value[id] || {})
|
all.value[id] = Object.assign(initial(), all.value[id] || {})
|
||||||
return all.value[id]
|
return all.value[id]
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue