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>
This commit is contained in:
Michael Telatynski 2024-05-15 15:58:28 +01:00 committed by GitHub
parent bec8fdb3d3
commit 113c365563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 13 additions and 45 deletions

View file

@ -97,11 +97,7 @@ export default class PasswordReset {
// Note: Though this sounds like a login type for identity servers only, it // Note: Though this sounds like a login type for identity servers only, it
// has a dual purpose of being used for homeservers too. // has a dual purpose of being used for homeservers too.
type: "m.login.email.identity", 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, threepid_creds: creds,
threepidCreds: creds,
}, },
this.password, this.password,
this.logoutDevices, this.logoutDevices,

View file

@ -316,9 +316,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
type: "m.id.user", type: "m.id.user",
user: MatrixClientPeg.safeGet().getSafeUserId(), 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, password: this.state.accountPassword,
}); });
} else { } else {

View file

@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. 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 { SimpleObservable } from "matrix-widget-api";
import { uploadFile } from "../ContentMessages"; import { uploadFile } from "../ContentMessages";
@ -26,7 +27,7 @@ import { IRecordingUpdate, RecordingState, VoiceRecording } from "./VoiceRecordi
export interface IUpload { export interface IUpload {
mxc?: string; // for unencrypted uploads mxc?: string; // for unencrypted uploads
encrypted?: IEncryptedFile; encrypted?: EncryptedFile;
} }
/** /**

View file

@ -121,9 +121,6 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
this.props.submitAuthDict({ this.props.submitAuthDict({
type: AuthType.Password, 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: { identifier: {
type: "m.id.user", type: "m.id.user",
user: this.props.matrixClient.credentials.userId, user: this.props.matrixClient.credentials.userId,
@ -634,11 +631,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
}; };
this.props.submitAuthDict({ this.props.submitAuthDict({
type: AuthType.Msisdn, 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, threepid_creds: creds,
threepidCreds: creds,
}); });
} else { } else {
this.setState({ this.setState({

View file

@ -101,9 +101,6 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
type: "m.id.user", type: "m.id.user",
user: MatrixClientPeg.safeGet().getUserId(), 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, password: this.state.accountPassword,
}); });
} else if (this.props.tokenLogin) { } else if (this.props.tokenLogin) {

View file

@ -99,9 +99,6 @@ export default class ChangePassword extends React.Component<IProps, IState> {
type: "m.id.user", type: "m.id.user",
user: cli.credentials.userId, 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, password: oldPassword,
}; };

View file

@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IEncryptedFile, MsgType } from "matrix-js-sdk/src/matrix"; import { MsgType } from "matrix-js-sdk/src/matrix";
import { RoomMessageEventContent } from "matrix-js-sdk/src/types"; import { EncryptedFile, RoomMessageEventContent } from "matrix-js-sdk/src/types";
/** /**
* @param {string} mxc MXC URL of the file * @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} duration Duration in milliseconds
* @param {number} size * @param {number} size
* @param {number[]} [waveform] * @param {number[]} [waveform]
* @param {IEncryptedFile} [file] Encrypted file * @param {EncryptedFile} [file] Encrypted file
*/ */
export const createVoiceMessageContent = ( export const createVoiceMessageContent = (
mxc: string | undefined, mxc: string | undefined,
mimetype: string, mimetype: string,
duration: number, duration: number,
size: number, size: number,
file?: IEncryptedFile, file?: EncryptedFile,
waveform?: number[], waveform?: number[],
): RoomMessageEventContent => { ): RoomMessageEventContent => {
return { return {

View file

@ -15,7 +15,8 @@ limitations under the License.
*/ */
import { mocked } from "jest-mock"; 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 { createVoiceMessageRecording, VoiceMessageRecording } from "../../src/audio/VoiceMessageRecording";
import { RecordingState, VoiceRecording } from "../../src/audio/VoiceRecording"; import { RecordingState, VoiceRecording } from "../../src/audio/VoiceRecording";
@ -122,7 +123,7 @@ describe("VoiceMessageRecording", () => {
describe("when the first data has been received", () => { describe("when the first data has been received", () => {
const uploadUrl = "https://example.com/content123"; const uploadUrl = "https://example.com/content123";
const encryptedFile = {} as unknown as IEncryptedFile; const encryptedFile = {} as unknown as EncryptedFile;
beforeEach(() => { beforeEach(() => {
voiceRecording.onDataAvailable!(testBuf); voiceRecording.onDataAvailable!(testBuf);
@ -158,7 +159,7 @@ describe("VoiceMessageRecording", () => {
roomId: string, roomId: string,
file: File | Blob, file: File | Blob,
_progressHandler?: UploadOpts["progressHandler"], _progressHandler?: UploadOpts["progressHandler"],
): Promise<{ url?: string; file?: IEncryptedFile }> => { ): Promise<{ url?: string; file?: EncryptedFile }> => {
uploadFileClient = matrixClient; uploadFileClient = matrixClient;
uploadFileRoomId = roomId; uploadFileRoomId = roomId;
uploadBlob = file; uploadBlob = file;

View file

@ -302,10 +302,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String), client_secret: expect.any(String),
sid: testSid, sid: testSid,
}, },
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
}, },
testPassword, testPassword,
false, false,
@ -334,10 +330,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String), client_secret: expect.any(String),
sid: testSid, sid: testSid,
}, },
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
}, },
testPassword, testPassword,
false, false,
@ -430,10 +422,6 @@ describe("<ForgotPassword>", () => {
client_secret: expect.any(String), client_secret: expect.any(String),
sid: testSid, sid: testSid,
}, },
threepidCreds: {
client_secret: expect.any(String),
sid: testSid,
},
}, },
testPassword, testPassword,
true, true,

View file

@ -1048,7 +1048,6 @@ describe("<SessionManagerTab />", () => {
}, },
password: "", password: "",
type: "m.login.password", type: "m.login.password",
user: aliceId,
}); });
// devices refreshed // devices refreshed
expect(mockClient.getDevices).toHaveBeenCalled(); expect(mockClient.getDevices).toHaveBeenCalled();

View file

@ -641,7 +641,6 @@ export function mkStubRoom(
roomId, roomId,
setBlacklistUnverifiedDevices: jest.fn(), setBlacklistUnverifiedDevices: jest.fn(),
setUnreadNotificationCount: jest.fn(), setUnreadNotificationCount: jest.fn(),
shouldUpgradeToVersion: (() => null) as () => string | null,
tags: {}, tags: {},
timeline: [], timeline: [],
} as unknown as Room; } as unknown as Room;

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. 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"; import { createVoiceMessageContent } from "../../src/utils/createVoiceMessageContent";
@ -26,7 +26,7 @@ describe("createVoiceMessageContent", () => {
"ogg/opus", "ogg/opus",
23000, 23000,
42000, 42000,
{} as unknown as IEncryptedFile, {} as unknown as EncryptedFile,
[1, 2, 3], [1, 2, 3],
), ),
).toMatchSnapshot(); ).toMatchSnapshot();