chore: only show non-invited contacts in vault invite dialog
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
|||||||
ClientDisplayableError,
|
ClientDisplayableError,
|
||||||
SharedVaultInviteServerHash,
|
SharedVaultInviteServerHash,
|
||||||
SharedVaultUserServerHash,
|
SharedVaultUserServerHash,
|
||||||
|
isClientDisplayableError,
|
||||||
isErrorResponse,
|
isErrorResponse,
|
||||||
} from '@standardnotes/responses'
|
} from '@standardnotes/responses'
|
||||||
import { AbstractService } from './../Service/AbstractService'
|
import { AbstractService } from './../Service/AbstractService'
|
||||||
@@ -162,9 +163,16 @@ export class VaultInviteService
|
|||||||
if (contacts.isFailed()) {
|
if (contacts.isFailed()) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const outboundInvites = await this.getOutboundInvites(sharedVault)
|
||||||
|
if (isClientDisplayableError(outboundInvites)) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
return contacts.getValue().filter((contact) => {
|
return contacts.getValue().filter((contact) => {
|
||||||
const isContactAlreadyInVault = users.some((user) => user.user_uuid === contact.contactUuid)
|
const isContactAlreadyInVault = users.some((user) => user.user_uuid === contact.contactUuid)
|
||||||
return !isContactAlreadyInVault
|
const isContactAlreadyInvited = outboundInvites.some((invite) => invite.user_uuid === contact.contactUuid)
|
||||||
|
return !isContactAlreadyInVault && !isContactAlreadyInvited
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user