publish to sync server

This commit is contained in:
2026-02-09 12:34:22 +00:00
parent ef169e76db
commit 2c547f766a

View File

@@ -32,12 +32,14 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
// Try to get the invitation from the storage
const invitationFromStorage = await dependencies.storage.get(invitation);
if (invitationFromStorage) {
console.log(`Invitation found in storage: ${invitation}`);
return this.create(invitationFromStorage, dependencies);
}
// Try to get the invitation from the sync server
const invitationFromSyncServer = await dependencies.syncServer.getInvitation(invitation);
if (invitationFromSyncServer) {
if (invitationFromSyncServer && invitationFromSyncServer.invitationIdentifier === invitation) {
console.log(`Invitation found in sync server: ${invitation}`);
return this.create(invitationFromSyncServer, dependencies);
}
@@ -141,6 +143,9 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
// Store the invitation in the storage
await this.storage.set(this.data.invitationIdentifier, this.data);
// Publish the invitation to the sync server
this.syncServer.publishInvitation(this.data);
// Compute and emit initial status
await this.updateStatus();
}