From 113c36556366b42fa9aaa5eabf188244cb79a505 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 15 May 2024 15:58:28 +0100 Subject: [PATCH] Stop using deprecated methods, fields & exports (#12524) * Remove legacy `threepidCreds` field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove `user` field legacy UIA fallback Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update imports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/PasswordReset.ts | 4 ---- .../dialogs/security/CreateSecretStorageDialog.tsx | 3 --- src/audio/VoiceMessageRecording.ts | 5 +++-- .../views/auth/InteractiveAuthEntryComponents.tsx | 7 ------- .../dialogs/security/CreateCrossSigningDialog.tsx | 3 --- src/components/views/settings/ChangePassword.tsx | 3 --- src/utils/createVoiceMessageContent.ts | 8 ++++---- test/audio/VoiceMessageRecording-test.ts | 7 ++++--- .../structures/auth/ForgotPassword-test.tsx | 12 ------------ .../settings/tabs/user/SessionManagerTab-test.tsx | 1 - test/test-utils/test-utils.ts | 1 - test/utils/createVoiceMessageContent-test.ts | 4 ++-- 12 files changed, 13 insertions(+), 45 deletions(-) diff --git a/src/PasswordReset.ts b/src/PasswordReset.ts index ecff316e6c..0564f008ac 100644 --- a/src/PasswordReset.ts +++ b/src/PasswordReset.ts @@ -97,11 +97,7 @@ export default class PasswordReset { // Note: Though this sounds like a login type for identity servers only, it // has a dual purpose of being used for homeservers too. type: "m.login.email.identity", - // TODO: Remove `threepid_creds` once servers support proper UIA - // See https://github.com/matrix-org/synapse/issues/5665 - // See https://github.com/matrix-org/matrix-doc/issues/2220 threepid_creds: creds, - threepidCreds: creds, }, this.password, this.logoutDevices, diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index d21164ec8e..0316c43994 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -316,9 +316,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent { type: "m.id.user", user: cli.credentials.userId, }, - // TODO: Remove `user` once servers support proper UIA - // See https://github.com/matrix-org/synapse/issues/5665 - user: cli.credentials.userId ?? undefined, password: oldPassword, }; diff --git a/src/utils/createVoiceMessageContent.ts b/src/utils/createVoiceMessageContent.ts index 06bd335389..90c8cabe9f 100644 --- a/src/utils/createVoiceMessageContent.ts +++ b/src/utils/createVoiceMessageContent.ts @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IEncryptedFile, MsgType } from "matrix-js-sdk/src/matrix"; -import { RoomMessageEventContent } from "matrix-js-sdk/src/types"; +import { MsgType } from "matrix-js-sdk/src/matrix"; +import { EncryptedFile, RoomMessageEventContent } from "matrix-js-sdk/src/types"; /** * @param {string} mxc MXC URL of the file @@ -23,14 +23,14 @@ import { RoomMessageEventContent } from "matrix-js-sdk/src/types"; * @param {number} duration Duration in milliseconds * @param {number} size * @param {number[]} [waveform] - * @param {IEncryptedFile} [file] Encrypted file + * @param {EncryptedFile} [file] Encrypted file */ export const createVoiceMessageContent = ( mxc: string | undefined, mimetype: string, duration: number, size: number, - file?: IEncryptedFile, + file?: EncryptedFile, waveform?: number[], ): RoomMessageEventContent => { return { diff --git a/test/audio/VoiceMessageRecording-test.ts b/test/audio/VoiceMessageRecording-test.ts index 94fca82bce..22cd3d44ec 100644 --- a/test/audio/VoiceMessageRecording-test.ts +++ b/test/audio/VoiceMessageRecording-test.ts @@ -15,7 +15,8 @@ limitations under the License. */ import { mocked } from "jest-mock"; -import { IEncryptedFile, UploadOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { UploadOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { EncryptedFile } from "matrix-js-sdk/src/types"; import { createVoiceMessageRecording, VoiceMessageRecording } from "../../src/audio/VoiceMessageRecording"; import { RecordingState, VoiceRecording } from "../../src/audio/VoiceRecording"; @@ -122,7 +123,7 @@ describe("VoiceMessageRecording", () => { describe("when the first data has been received", () => { const uploadUrl = "https://example.com/content123"; - const encryptedFile = {} as unknown as IEncryptedFile; + const encryptedFile = {} as unknown as EncryptedFile; beforeEach(() => { voiceRecording.onDataAvailable!(testBuf); @@ -158,7 +159,7 @@ describe("VoiceMessageRecording", () => { roomId: string, file: File | Blob, _progressHandler?: UploadOpts["progressHandler"], - ): Promise<{ url?: string; file?: IEncryptedFile }> => { + ): Promise<{ url?: string; file?: EncryptedFile }> => { uploadFileClient = matrixClient; uploadFileRoomId = roomId; uploadBlob = file; diff --git a/test/components/structures/auth/ForgotPassword-test.tsx b/test/components/structures/auth/ForgotPassword-test.tsx index 6977fe9ec4..b43e6bea6a 100644 --- a/test/components/structures/auth/ForgotPassword-test.tsx +++ b/test/components/structures/auth/ForgotPassword-test.tsx @@ -302,10 +302,6 @@ describe("", () => { client_secret: expect.any(String), sid: testSid, }, - threepidCreds: { - client_secret: expect.any(String), - sid: testSid, - }, }, testPassword, false, @@ -334,10 +330,6 @@ describe("", () => { client_secret: expect.any(String), sid: testSid, }, - threepidCreds: { - client_secret: expect.any(String), - sid: testSid, - }, }, testPassword, false, @@ -430,10 +422,6 @@ describe("", () => { client_secret: expect.any(String), sid: testSid, }, - threepidCreds: { - client_secret: expect.any(String), - sid: testSid, - }, }, testPassword, true, diff --git a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx index f62515d04b..c34b115945 100644 --- a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx +++ b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx @@ -1048,7 +1048,6 @@ describe("", () => { }, password: "", type: "m.login.password", - user: aliceId, }); // devices refreshed expect(mockClient.getDevices).toHaveBeenCalled(); diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index 41bb04759c..0759f2e739 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -641,7 +641,6 @@ export function mkStubRoom( roomId, setBlacklistUnverifiedDevices: jest.fn(), setUnreadNotificationCount: jest.fn(), - shouldUpgradeToVersion: (() => null) as () => string | null, tags: {}, timeline: [], } as unknown as Room; diff --git a/test/utils/createVoiceMessageContent-test.ts b/test/utils/createVoiceMessageContent-test.ts index 876722baf7..4abf01eee6 100644 --- a/test/utils/createVoiceMessageContent-test.ts +++ b/test/utils/createVoiceMessageContent-test.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IEncryptedFile } from "matrix-js-sdk/src/matrix"; +import { EncryptedFile } from "matrix-js-sdk/src/types"; import { createVoiceMessageContent } from "../../src/utils/createVoiceMessageContent"; @@ -26,7 +26,7 @@ describe("createVoiceMessageContent", () => { "ogg/opus", 23000, 42000, - {} as unknown as IEncryptedFile, + {} as unknown as EncryptedFile, [1, 2, 3], ), ).toMatchSnapshot();