File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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' ) ;
You can’t perform that action at this time.
0 commit comments