Reload when upgrade (#5942)

This commit is contained in:
Denis Bykhov
2024-06-28 22:11:35 +07:00
committed by GitHub
parent bb87db700c
commit 4fb5ca1d17
5 changed files with 10 additions and 12 deletions
+1 -6
View File
@@ -38,8 +38,6 @@ import core, {
TxApplyIf,
TxHandler,
TxResult,
TxWorkspaceEvent,
WorkspaceEvent,
generateId,
toFindResult
} from '@hcengineering/core'
@@ -356,10 +354,7 @@ class Connection implements ClientConnection {
const txArr = Array.isArray(resp.result) ? (resp.result as Tx[]) : [resp.result as Tx]
for (const tx of txArr) {
if (
(tx?._class === core.class.TxWorkspaceEvent && (tx as TxWorkspaceEvent).event === WorkspaceEvent.Upgrade) ||
tx?._class === core.class.TxModelUpgrade
) {
if (tx?._class === core.class.TxModelUpgrade) {
console.log('Processing upgrade', this.workspace, this.email)
this.onUpgrade?.()
return
+5 -3
View File
@@ -94,11 +94,13 @@ export default async () => {
const upgradeHandler: TxHandler = (...txes: Tx[]) => {
for (const tx of txes) {
if (tx?._class === core.class.TxModelUpgrade) {
onUpgrade?.()
return
}
if (tx?._class === core.class.TxWorkspaceEvent) {
const event = tx as TxWorkspaceEvent
if (event.event === WorkspaceEvent.Upgrade) {
onUpgrade?.()
} else if (event.event === WorkspaceEvent.MaintenanceNotification) {
if (event.event === WorkspaceEvent.MaintenanceNotification) {
void setPlatformStatus(
new Status(Severity.WARNING, platform.status.MaintenanceWarning, {
time: event.params.timeMinutes