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

Commit 113c365

Browse files
authored
Stop using deprecated methods, fields & exports (#12524)
* Remove legacy `threepidCreds` field Signed-off-by: Michael Telatynski <[email protected]> * Remove `user` field legacy UIA fallback Signed-off-by: Michael Telatynski <[email protected]> * Update imports Signed-off-by: Michael Telatynski <[email protected]> * Fix test Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent bec8fdb commit 113c365

File tree

12 files changed

+13
-45
lines changed

12 files changed

+13
-45
lines changed

src/PasswordReset.ts

-4
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ export default class PasswordReset {
9797
// Note: Though this sounds like a login type for identity servers only, it
9898
// has a dual purpose of being used for homeservers too.
9999
type: "m.login.email.identity",
100-
// TODO: Remove `threepid_creds` once servers support proper UIA
101-
// See https://github.com/matrix-org/synapse/issues/5665
102-
// See https://github.com/matrix-org/matrix-doc/issues/2220
103100
threepid_creds: creds,
104-
threepidCreds: creds,
105101
},
106102
this.password,
107103
this.logoutDevices,

src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
316316
type: "m.id.user",
317317
user: MatrixClientPeg.safeGet().getSafeUserId(),
318318
},
319-
// TODO: Remove `user` once servers support proper UIA
320-
// See https://github.com/matrix-org/synapse/issues/5665
321-
user: MatrixClientPeg.safeGet().getSafeUserId(),
322319
password: this.state.accountPassword,
323320
});
324321
} else {

src/audio/VoiceMessageRecording.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { IEncryptedFile, MatrixClient } from "matrix-js-sdk/src/matrix";
17+
import { MatrixClient } from "matrix-js-sdk/src/matrix";
18+
import { EncryptedFile } from "matrix-js-sdk/src/types";
1819
import { SimpleObservable } from "matrix-widget-api";
1920

2021
import { uploadFile } from "../ContentMessages";
@@ -26,7 +27,7 @@ import { IRecordingUpdate, RecordingState, VoiceRecording } from "./VoiceRecordi
2627

2728
export interface IUpload {
2829
mxc?: string; // for unencrypted uploads
29-
encrypted?: IEncryptedFile;
30+
encrypted?: EncryptedFile;
3031
}
3132

3233
/**

src/components/views/auth/InteractiveAuthEntryComponents.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
121121

122122
this.props.submitAuthDict({
123123
type: AuthType.Password,
124-
// TODO: Remove `user` once servers support proper UIA
125-
// See https://github.com/vector-im/element-web/issues/10312
126-
user: this.props.matrixClient.credentials.userId ?? undefined,
127124
identifier: {
128125
type: "m.id.user",
129126
user: this.props.matrixClient.credentials.userId,
@@ -634,11 +631,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
634631
};
635632
this.props.submitAuthDict({
636633
type: AuthType.Msisdn,
637-
// TODO: Remove `threepid_creds` once servers support proper UIA
638-
// See https://github.com/vector-im/element-web/issues/10312
639-
// See https://github.com/matrix-org/matrix-doc/issues/2220
640634
threepid_creds: creds,
641-
threepidCreds: creds,
642635
});
643636
} else {
644637
this.setState({

src/components/views/dialogs/security/CreateCrossSigningDialog.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
101101
type: "m.id.user",
102102
user: MatrixClientPeg.safeGet().getUserId(),
103103
},
104-
// TODO: Remove `user` once servers support proper UIA
105-
// See https://github.com/matrix-org/synapse/issues/5665
106-
user: MatrixClientPeg.safeGet().getUserId(),
107104
password: this.state.accountPassword,
108105
});
109106
} else if (this.props.tokenLogin) {

src/components/views/settings/ChangePassword.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ export default class ChangePassword extends React.Component<IProps, IState> {
9999
type: "m.id.user",
100100
user: cli.credentials.userId,
101101
},
102-
// TODO: Remove `user` once servers support proper UIA
103-
// See https://github.com/matrix-org/synapse/issues/5665
104-
user: cli.credentials.userId ?? undefined,
105102
password: oldPassword,
106103
};
107104

src/utils/createVoiceMessageContent.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { IEncryptedFile, MsgType } from "matrix-js-sdk/src/matrix";
18-
import { RoomMessageEventContent } from "matrix-js-sdk/src/types";
17+
import { MsgType } from "matrix-js-sdk/src/matrix";
18+
import { EncryptedFile, RoomMessageEventContent } from "matrix-js-sdk/src/types";
1919

2020
/**
2121
* @param {string} mxc MXC URL of the file
2222
* @param {string} mimetype
2323
* @param {number} duration Duration in milliseconds
2424
* @param {number} size
2525
* @param {number[]} [waveform]
26-
* @param {IEncryptedFile} [file] Encrypted file
26+
* @param {EncryptedFile} [file] Encrypted file
2727
*/
2828
export const createVoiceMessageContent = (
2929
mxc: string | undefined,
3030
mimetype: string,
3131
duration: number,
3232
size: number,
33-
file?: IEncryptedFile,
33+
file?: EncryptedFile,
3434
waveform?: number[],
3535
): RoomMessageEventContent => {
3636
return {

test/audio/VoiceMessageRecording-test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ limitations under the License.
1515
*/
1616

1717
import { mocked } from "jest-mock";
18-
import { IEncryptedFile, UploadOpts, MatrixClient } from "matrix-js-sdk/src/matrix";
18+
import { UploadOpts, MatrixClient } from "matrix-js-sdk/src/matrix";
19+
import { EncryptedFile } from "matrix-js-sdk/src/types";
1920

2021
import { createVoiceMessageRecording, VoiceMessageRecording } from "../../src/audio/VoiceMessageRecording";
2122
import { RecordingState, VoiceRecording } from "../../src/audio/VoiceRecording";
@@ -122,7 +123,7 @@ describe("VoiceMessageRecording", () => {
122123

123124
describe("when the first data has been received", () => {
124125
const uploadUrl = "https://example.com/content123";
125-
const encryptedFile = {} as unknown as IEncryptedFile;
126+
const encryptedFile = {} as unknown as EncryptedFile;
126127

127128
beforeEach(() => {
128129
voiceRecording.onDataAvailable!(testBuf);
@@ -158,7 +159,7 @@ describe("VoiceMessageRecording", () => {
158159
roomId: string,
159160
file: File | Blob,
160161
_progressHandler?: UploadOpts["progressHandler"],
161-
): Promise<{ url?: string; file?: IEncryptedFile }> => {
162+
): Promise<{ url?: string; file?: EncryptedFile }> => {
162163
uploadFileClient = matrixClient;
163164
uploadFileRoomId = roomId;
164165
uploadBlob = file;

test/components/structures/auth/ForgotPassword-test.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ describe("<ForgotPassword>", () => {
302302
client_secret: expect.any(String),
303303
sid: testSid,
304304
},
305-
threepidCreds: {
306-
client_secret: expect.any(String),
307-
sid: testSid,
308-
},
309305
},
310306
testPassword,
311307
false,
@@ -334,10 +330,6 @@ describe("<ForgotPassword>", () => {
334330
client_secret: expect.any(String),
335331
sid: testSid,
336332
},
337-
threepidCreds: {
338-
client_secret: expect.any(String),
339-
sid: testSid,
340-
},
341333
},
342334
testPassword,
343335
false,
@@ -430,10 +422,6 @@ describe("<ForgotPassword>", () => {
430422
client_secret: expect.any(String),
431423
sid: testSid,
432424
},
433-
threepidCreds: {
434-
client_secret: expect.any(String),
435-
sid: testSid,
436-
},
437425
},
438426
testPassword,
439427
true,

test/components/views/settings/tabs/user/SessionManagerTab-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,6 @@ describe("<SessionManagerTab />", () => {
10481048
},
10491049
password: "",
10501050
type: "m.login.password",
1051-
user: aliceId,
10521051
});
10531052
// devices refreshed
10541053
expect(mockClient.getDevices).toHaveBeenCalled();

test/test-utils/test-utils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ export function mkStubRoom(
641641
roomId,
642642
setBlacklistUnverifiedDevices: jest.fn(),
643643
setUnreadNotificationCount: jest.fn(),
644-
shouldUpgradeToVersion: (() => null) as () => string | null,
645644
tags: {},
646645
timeline: [],
647646
} as unknown as Room;

test/utils/createVoiceMessageContent-test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { IEncryptedFile } from "matrix-js-sdk/src/matrix";
17+
import { EncryptedFile } from "matrix-js-sdk/src/types";
1818

1919
import { createVoiceMessageContent } from "../../src/utils/createVoiceMessageContent";
2020

@@ -26,7 +26,7 @@ describe("createVoiceMessageContent", () => {
2626
"ogg/opus",
2727
23000,
2828
42000,
29-
{} as unknown as IEncryptedFile,
29+
{} as unknown as EncryptedFile,
3030
[1, 2, 3],
3131
),
3232
).toMatchSnapshot();

0 commit comments

Comments
 (0)