Expected UTDs: report a different Posthog code (#12389)

* `DecryptionFailureTracker`: stronger typing

Use `DecryptionFailureCode` rather than string

* `DecryptionFailureTracker`: remove use of `DecryptionError`

The second argument to `MatrixEventEvent.Decrypted` callbacks is deprecatedf,
and we can get the info we need direct from the event. This means that we no
longer need to reference the internal `DecryptionError` class in the js-sdk.

* `DecryptionFailureTracker`: use a different Posthog code for historical UTDs

* Update for new UTD error codes
This commit is contained in:
Richard van der Hoff 2024-04-17 13:36:01 +01:00 committed by GitHub
parent 6cec2bba0f
commit 04b5b587a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 84 additions and 134 deletions

View file

@ -32,7 +32,6 @@ import { defer, IDeferred, QueryDict } from "matrix-js-sdk/src/utils";
import { logger } from "matrix-js-sdk/src/logger";
import { throttle } from "lodash";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { DecryptionError } from "matrix-js-sdk/src/crypto/algorithms";
import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup";
import { TooltipProvider } from "@vector-im/compound-web";
@ -1598,7 +1597,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
// When logging out, stop tracking failures and destroy state
cli.on(HttpApiEvent.SessionLoggedOut, () => dft.stop());
cli.on(MatrixEventEvent.Decrypted, (e, err) => dft.eventDecrypted(e, err as DecryptionError));
cli.on(MatrixEventEvent.Decrypted, (e) => dft.eventDecrypted(e));
cli.on(ClientEvent.Room, (room) => {
if (cli.isCryptoEnabled()) {