Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Use new accessors for VerificationRequest #11092

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Jun 14, 2023

(Requires matrix-org/matrix-js-sdk#3474 -- now merged)

Fixes vector-im/crypto-internal#97. Fixes vector-im/crypto-internal#98.


This change is marked as an internal change (Task), so will not be included in the changelog.

@richvdh richvdh force-pushed the rav/element-r/19_verification_accessors branch from ab18051 to e0779de Compare June 15, 2023 13:43
@richvdh richvdh marked this pull request as ready for review June 15, 2023 14:39
@richvdh richvdh requested a review from a team as a code owner June 15, 2023 14:39
@@ -89,7 +89,7 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
private onVerifyClick = (): void => {
const cli = MatrixClientPeg.get();
const userId = cli.getSafeUserId();
const requestPromise = cli.requestVerification(userId);
const requestPromise = cli.getCrypto()!.requestOwnUserVerification();
Copy link
Contributor

@florianduros florianduros Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we assume that the crypto is defined here ?

Can we use instead cli.getCrypto()?.requestOwnUserVerification() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we assume that the crypto is defined here ?

Yes. I'm reasonably sure that SetupEncryptionBody is only used when getCrypto returns something -- and SetupEncryptionStore (which is required for SetupEncryptionBody) makes the same assumption.

Can we use instead cli.getCrypto()?.requestOwnUserVerification() ?

mmm; unfortunately I don't think it's as simple as that. VerificationRequestDialog requires a (non-null) verificationRequestPromise; we could add an if statement and return instead of showing the dialog, but then we get into untestable code - and if the code is ever reachable then the UX is arguably just as bad as spamming an exception into the logs.

@richvdh richvdh added this pull request to the merge queue Jun 16, 2023
Merged via the queue into develop with commit 06fa49a Jun 16, 2023
@richvdh richvdh deleted the rav/element-r/19_verification_accessors branch June 16, 2023 10:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants