fix(session): fix unshare command not clearing share state (#5523)

This commit is contained in:
Ravi Kumar
2025-12-15 09:35:06 +05:30
committed by GitHub
parent 6a09861806
commit 54569b5552
4 changed files with 15 additions and 22 deletions

View File

@@ -234,22 +234,12 @@ export namespace Session {
})
export const unshare = fn(Identifier.schema("session"), async (id) => {
const cfg = await Config.get()
if (cfg.enterprise?.url) {
const { ShareNext } = await import("@/share/share-next")
await ShareNext.remove(id)
await update(id, (draft) => {
draft.share = undefined
})
}
const share = await getShare(id)
if (!share) return
await Storage.remove(["share", id])
// Use ShareNext to remove the share (same as share function uses ShareNext to create)
const { ShareNext } = await import("@/share/share-next")
await ShareNext.remove(id)
await update(id, (draft) => {
draft.share = undefined
})
const { Share } = await import("../share/share")
await Share.remove(id, share.secret)
})
export async function update(id: string, editor: (session: Info) => void) {