Fix minor office bugs (#6116)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-07-22 20:55:42 +05:00 committed by GitHub
parent 0f1231e572
commit fe12d4930f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View File

@ -244,16 +244,12 @@
if (isConnected) {
await disconnect()
}
} else if (!isConnected) {
const person = $personByIdStore.get(me)
if (person === undefined) return
await connectRoom(0, 0, myInfo, person, myOffice)
}
}
}
}
$: checkOwnRoomConnection($infos, $myInfo, $myOffice, $isConnected)
$: checkOwnRoomConnection($infos, $myInfo, $myOffice, $isCurrentInstanceConnected)
const myInvitesCategory = 'myInvites'
@ -350,6 +346,18 @@
participantClickHandler(e, participant)
}
}
onDestroy(() => {
removeEventListener('beforeunload', beforeUnloadListener)
})
const beforeUnloadListener = () => {
if ($myInfo !== undefined) {
leaveRoom($myInfo, $myOffice)
}
}
window.addEventListener('beforeunload', beforeUnloadListener)
</script>
<div class="flex-row-center flex-gap-2">

View File

@ -36,8 +36,8 @@
const person = $personByIdStore.get(me)
if (person === undefined) return
await connectRoom(0, 0, $myInfo, person, $myOffice)
await client.update(request, { status: RequestStatus.Approved })
}
await client.update(request, { status: RequestStatus.Approved })
}
async function decline (): Promise<void> {

View File

@ -100,8 +100,7 @@ async function createUserInfo (acc: Ref<Account>, control: TriggerControl): Prom
[tx],
'createUserInfo'
)
await control.apply([ptx])
return []
return [ptx]
}
async function removeUserInfo (acc: Ref<Account>, control: TriggerControl): Promise<Tx[]> {

View File

@ -783,6 +783,10 @@ export class TServerStorage implements ServerStorage {
)
const aresult = await performAsync(applyCtx)
if (aresult.length > 0) {
await this.apply(applyCtx, aresult)
}
if (applyTxes.length > 0) {
await this.apply(applyCtx, applyTxes)
}