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

Stop using deprecated methods, fields & exports #12524

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/PasswordReset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
type: "m.id.user",
user: MatrixClientPeg.safeGet().getSafeUserId(),
},
// TODO: Remove `user` once servers support proper UIA
// See https://github.com/matrix-org/synapse/issues/5665
user: MatrixClientPeg.safeGet().getSafeUserId(),
password: this.state.accountPassword,
});
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/audio/VoiceMessageRecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

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

export interface IUpload {
mxc?: string; // for unencrypted uploads
encrypted?: IEncryptedFile;
encrypted?: EncryptedFile;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor

this.props.submitAuthDict({
type: AuthType.Password,
// TODO: Remove `user` once servers support proper UIA
// See https://github.com/vector-im/element-web/issues/10312
user: this.props.matrixClient.credentials.userId ?? undefined,
identifier: {
type: "m.id.user",
user: this.props.matrixClient.credentials.userId,
Expand Down Expand Up @@ -634,11 +631,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
};
this.props.submitAuthDict({
type: AuthType.Msisdn,
// TODO: Remove `threepid_creds` once servers support proper UIA
// See https://github.com/vector-im/element-web/issues/10312
// See https://github.com/matrix-org/matrix-doc/issues/2220
threepid_creds: creds,
threepidCreds: creds,
});
} else {
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
type: "m.id.user",
user: MatrixClientPeg.safeGet().getUserId(),
},
// TODO: Remove `user` once servers support proper UIA
// See https://github.com/matrix-org/synapse/issues/5665
user: MatrixClientPeg.safeGet().getUserId(),
password: this.state.accountPassword,
});
} else if (this.props.tokenLogin) {
Expand Down
3 changes: 0 additions & 3 deletions src/components/views/settings/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ export default class ChangePassword extends React.Component<IProps, IState> {
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,
};

Expand Down
8 changes: 4 additions & 4 deletions src/utils/createVoiceMessageContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ 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
* @param {string} mimetype
* @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 {
Expand Down
7 changes: 4 additions & 3 deletions test/audio/VoiceMessageRecording-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions test/components/structures/auth/ForgotPassword-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String),
sid: testSid,
},
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
},
testPassword,
false,
Expand Down Expand Up @@ -334,10 +330,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String),
sid: testSid,
},
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
},
testPassword,
false,
Expand Down Expand Up @@ -430,10 +422,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String),
sid: testSid,
},
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
},
testPassword,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,6 @@ describe("<SessionManagerTab />", () => {
},
password: "",
type: "m.login.password",
user: aliceId,
});
// devices refreshed
expect(mockClient.getDevices).toHaveBeenCalled();
Expand Down
1 change: 0 additions & 1 deletion test/test-utils/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/utils/createVoiceMessageContent-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -26,7 +26,7 @@ describe("createVoiceMessageContent", () => {
"ogg/opus",
23000,
42000,
{} as unknown as IEncryptedFile,
{} as unknown as EncryptedFile,
[1, 2, 3],
),
).toMatchSnapshot();
Expand Down
Loading