Skip to content

Commit c3b1da0

Browse files
committed
feat: multi-invite support and revoke fix
- Add incomingCollectorClients getter on Contact (filter by Incoming status) - Fix revoke() to handle CCs without accessData (skip access deletion, still update status)
1 parent 095bd9f commit c3b1da0

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

ts/appTemplates/CollectorClient.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,15 @@ export class CollectorClient {
267267
}
268268

269269
async revoke () {
270-
if (!this.accessData) {
271-
throw new HDSLibError('Cannot revoke if no accessData');
272-
}
273-
if (this.accessData.deleted && this.status === CollectorClient.STATUSES.deactivated) {
270+
if (this.accessData?.deleted && this.status === CollectorClient.STATUSES.deactivated) {
274271
throw new HDSLibError('Already revoked');
275272
}
276-
// revoke access
277-
await this.app.connection.apiOne('accesses.delete', { id: this.accessData.id }, 'accessDeletion');
278-
// lazyly flag currentAccess as deleted
279-
this.accessData.deleted = Date.now() / 1000;
273+
// revoke access if it exists and is not already deleted
274+
if (this.accessData && !this.accessData.deleted) {
275+
await this.app.connection.apiOne('accesses.delete', { id: this.accessData.id }, 'accessDeletion');
276+
// lazily flag currentAccess as deleted
277+
this.accessData.deleted = Date.now() / 1000;
278+
}
280279

281280
const responseContent = { };
282281
const requesterEvent = await this.#updateRequester('revoke', responseContent);

ts/appTemplates/Contact.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ export class Contact {
184184
this.collectorClients[0];
185185
}
186186

187+
/** CollectorClients with status Incoming — pending accept/refuse */
188+
get incomingCollectorClients (): CollectorClient[] {
189+
return this.collectorClients.filter(cc => cc.status === 'Incoming');
190+
}
191+
187192
/** Whether any form is pending (Incoming) and actionable */
188193
get isPending (): boolean {
189194
return this.collectorClients.some(cc => cc.status === 'Incoming');

0 commit comments

Comments
 (0)