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

Commit

Permalink
Merge branch 'develop' into t3chguy/fix/25832
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Aug 15, 2023
2 parents fa0ec5d + 65b518d commit 40d7811
Show file tree
Hide file tree
Showing 28 changed files with 82 additions and 204 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
Changes in [3.78.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.78.0) (2023-08-15)
=====================================================================================================

## 🦖 Deprecations
* Deprecate camelCase config options ([\#11261](https://github.com/matrix-org/matrix-react-sdk/pull/11261)).

## ✨ Features
* Allow knocking rooms ([\#11353](https://github.com/matrix-org/matrix-react-sdk/pull/11353)). Contributed by @charlynguyen.
* Support adding space-restricted joins on rooms not members of those spaces ([\#9017](https://github.com/matrix-org/matrix-react-sdk/pull/9017)). Fixes vector-im/element-web#19213.
* Clear requiresClient and show pop-out if widget-api fails to ready ([\#11321](https://github.com/matrix-org/matrix-react-sdk/pull/11321)). Fixes vector-im/customer-retainer#73.
* Bump pagination sizes due to hidden events ([\#11342](https://github.com/matrix-org/matrix-react-sdk/pull/11342)).
* Remove display of key backup signatures from backup settings ([\#11333](https://github.com/matrix-org/matrix-react-sdk/pull/11333)).
* Use PassphraseFields in ExportE2eKeysDialog to enforce minimum passphrase complexity ([\#11222](https://github.com/matrix-org/matrix-react-sdk/pull/11222)). Fixes vector-im/element-web#9478.

## 🐛 Bug Fixes
* Fix "Export chat" not respecting configured time format in plain text mode ([\#10696](https://github.com/matrix-org/matrix-react-sdk/pull/10696)). Fixes vector-im/element-web#23838. Contributed by @rashmitpankhania.
* Fix some missing 1-count pluralisations around event list summaries ([\#11371](https://github.com/matrix-org/matrix-react-sdk/pull/11371)). Fixes vector-im/element-web#25925.
* Fix create subspace dialog not working for public space creation ([\#11367](https://github.com/matrix-org/matrix-react-sdk/pull/11367)). Fixes vector-im/element-web#25916.
* Search for users on paste ([\#11304](https://github.com/matrix-org/matrix-react-sdk/pull/11304)). Fixes vector-im/element-web#17523. Contributed by @peterscheu-aceart.
* Fix AppTile context menu not always showing up when it has options ([\#11358](https://github.com/matrix-org/matrix-react-sdk/pull/11358)). Fixes vector-im/element-web#25914.
* Fix clicking on home all rooms space notification not working ([\#11337](https://github.com/matrix-org/matrix-react-sdk/pull/11337)). Fixes vector-im/element-web#22844.
* Fix joining a suggested room switching space away ([\#11347](https://github.com/matrix-org/matrix-react-sdk/pull/11347)). Fixes vector-im/element-web#25838.
* Fix home/all rooms context menu in space panel ([\#11350](https://github.com/matrix-org/matrix-react-sdk/pull/11350)). Fixes vector-im/element-web#25896.
* Make keyboard handling in and out of autocomplete completions consistent ([\#11344](https://github.com/matrix-org/matrix-react-sdk/pull/11344)). Fixes vector-im/element-web#25878.
* De-duplicate reactions by sender to account for faulty/malicious servers ([\#11340](https://github.com/matrix-org/matrix-react-sdk/pull/11340)). Fixes vector-im/element-web#25872.
* Fix disable_3pid_login being ignored for the email field ([\#11335](https://github.com/matrix-org/matrix-react-sdk/pull/11335)). Fixes vector-im/element-web#25863.
* Upgrade wysiwyg editor for ctrl+backspace windows fix ([\#11324](https://github.com/matrix-org/matrix-react-sdk/pull/11324)). Fixes vector-im/verticals-internal#102.
* Unhide the view source event toggle - it works well enough ([\#11336](https://github.com/matrix-org/matrix-react-sdk/pull/11336)). Fixes vector-im/element-web#25861.

Changes in [3.77.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.77.1) (2023-08-04)
=====================================================================================================

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
"version": "3.77.1",
"version": "3.78.0",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
Expand Down
8 changes: 2 additions & 6 deletions src/AddThreepid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,15 @@ export default class AddThreepid {
): Promise<[success?: boolean, result?: IAuthData | Error | null] | undefined> {
const authClient = new IdentityAuthClient();

let result: { success: boolean } | MatrixError;
if (this.submitUrl) {
result = await this.matrixClient.submitMsisdnTokenOtherUrl(
await this.matrixClient.submitMsisdnTokenOtherUrl(
this.submitUrl,
this.sessionId!,
this.clientSecret,
msisdnToken,
);
} else if (this.bind) {
result = await this.matrixClient.submitMsisdnToken(
await this.matrixClient.submitMsisdnToken(
this.sessionId!,
this.clientSecret,
msisdnToken,
Expand All @@ -299,9 +298,6 @@ export default class AddThreepid {
} else {
throw new UserFriendlyError("The add / bind with MSISDN flow is misconfigured");
}
if (result instanceof Error) {
throw result;
}

if (this.bind) {
await this.matrixClient.bindThreePid({
Expand Down
33 changes: 15 additions & 18 deletions src/BasePlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default abstract class BasePlatform {
protected notificationCount = 0;
protected errorDidOccur = false;

public constructor() {
protected constructor() {
dis.register(this.onAction);
this.startUpdateCheck = this.startUpdateCheck.bind(this);
}
Expand Down Expand Up @@ -365,14 +365,7 @@ export default abstract class BasePlatform {
return null;
}

const additionalData = new Uint8Array(userId.length + deviceId.length + 1);
for (let i = 0; i < userId.length; i++) {
additionalData[i] = userId.charCodeAt(i);
}
additionalData[userId.length] = 124; // "|"
for (let i = 0; i < deviceId.length; i++) {
additionalData[userId.length + 1 + i] = deviceId.charCodeAt(i);
}
const additionalData = this.getPickleAdditionalData(userId, deviceId);

try {
const key = await crypto.subtle.decrypt(
Expand All @@ -387,6 +380,18 @@ export default abstract class BasePlatform {
}
}

private getPickleAdditionalData(userId: string, deviceId: string): Uint8Array {
const additionalData = new Uint8Array(userId.length + deviceId.length + 1);
for (let i = 0; i < userId.length; i++) {
additionalData[i] = userId.charCodeAt(i);
}
additionalData[userId.length] = 124; // "|"
for (let i = 0; i < deviceId.length; i++) {
additionalData[userId.length + 1 + i] = deviceId.charCodeAt(i);
}
return additionalData;
}

/**
* Create and store a pickle key for encrypting libolm objects.
* @param {string} userId the user ID for the user that the pickle key is for.
Expand All @@ -408,15 +413,7 @@ export default abstract class BasePlatform {
const iv = new Uint8Array(32);
crypto.getRandomValues(iv);

const additionalData = new Uint8Array(userId.length + deviceId.length + 1);
for (let i = 0; i < userId.length; i++) {
additionalData[i] = userId.charCodeAt(i);
}
additionalData[userId.length] = 124; // "|"
for (let i = 0; i < deviceId.length; i++) {
additionalData[userId.length + 1 + i] = deviceId.charCodeAt(i);
}

const additionalData = this.getPickleAdditionalData(userId, deviceId);
const encrypted = await crypto.subtle.encrypt({ name: "AES-GCM", iv, additionalData }, cryptoKey, randomArray);

try {
Expand Down
4 changes: 0 additions & 4 deletions src/IdentityAuthClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ export default class IdentityAuthClient {
return window.localStorage.getItem("mx_is_access_token");
}

public hasCredentials(): boolean {
return Boolean(this.accessToken);
}

// Returns a promise that resolves to the access_token string from the IS
public async getAccessToken({ check = true } = {}): Promise<string | null> {
if (!this.authEnabled) {
Expand Down
9 changes: 0 additions & 9 deletions src/LegacyCallHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,6 @@ export default class LegacyCallHandler extends EventEmitter {
return this.calls.get(roomId) || null;
}

public getAnyActiveCall(): MatrixCall | null {
for (const call of this.calls.values()) {
if (call.state !== CallState.Ended) {
return call;
}
}
return null;
}

public getAllActiveCalls(): MatrixCall[] {
const activeCalls: MatrixCall[] = [];

Expand Down
35 changes: 0 additions & 35 deletions src/PasswordReset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,6 @@ export default class PasswordReset {
this.clientSecret = this.client.generateClientSecret();
}

/**
* Attempt to reset the user's password. This will trigger a side-effect of
* sending an email to the provided email address.
* @param {string} emailAddress The email address
* @param {string} newPassword The new password for the account.
* @param {boolean} logoutDevices Should all devices be signed out after the reset? Defaults to `true`.
* @return {Promise} Resolves when the email has been sent. Then call checkEmailLinkClicked().
*/
public async resetPassword(
emailAddress: string,
newPassword: string,
logoutDevices = true,
): Promise<IRequestTokenResponse> {
this.password = newPassword;
this.logoutDevices = logoutDevices;
this.sendAttempt++;

try {
const result = await this.client.requestPasswordEmailToken(
emailAddress,
this.clientSecret,
this.sendAttempt,
);
this.sessionId = result.sid;
return result;
} catch (err: any) {
if (err.errcode === "M_THREEPID_NOT_FOUND") {
err.message = _t("This email address was not found");
} else if (err.httpStatus) {
err.message = err.message + ` (Status ${err.httpStatus})`;
}
throw err;
}
}

/**
* Request a password reset token.
* This will trigger a side-effect of sending an email to the provided email address.
Expand Down
5 changes: 2 additions & 3 deletions src/RoomNotifs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ export function determineUnreadState(
return { symbol: null, count: trueCount, color: NotificationColor.Grey };
}

// We don't have any notified messages, but we might have unread messages. Let's
// find out.
let hasUnread = false;
// We don't have any notified messages, but we might have unread messages. Let's find out.
let hasUnread: boolean;
if (threadId) hasUnread = doesRoomOrThreadHaveUnreadMessages(room.getThread(threadId)!);
else hasUnread = doesRoomHaveUnreadMessages(room);

Expand Down
2 changes: 1 addition & 1 deletion src/ScalarMessaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ function canSendEvent(event: MessageEvent<any>, roomId: string): void {
}
const me = client.credentials.userId!;

let canSend = false;
let canSend: boolean;
if (isState) {
canSend = room.currentState.maySendStateEvent(evType, me);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/FeedbackDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
return (
<QuestionDialog
className="mx_FeedbackDialog"
hasCancelButton={!!hasFeedback}
hasCancelButton={hasFeedback}
title={_t("Feedback")}
description={
<React.Fragment>
Expand Down
2 changes: 1 addition & 1 deletion src/editor/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export default class EditorModel {
*/
public transform(callback: ManualTransformCallback): Promise<void> {
const pos = callback();
let acPromise: Promise<void> | null = null;
let acPromise: Promise<void> | null;
if (!(pos instanceof Range)) {
acPromise = this.setActivePart(pos, true);
} else {
Expand Down
7 changes: 0 additions & 7 deletions src/indexing/BaseEventIndexManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ export default abstract class BaseEventIndexManager {
throw new Error("Unimplemented");
}

/**
* Check if our event index is empty.
*/
public indexIsEmpty(): Promise<boolean> {
throw new Error("Unimplemented");
}

/**
* Check if the room with the given id is already indexed.
*
Expand Down
47 changes: 0 additions & 47 deletions src/integrations/IntegrationManagers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import IntegrationsImpossibleDialog from "../components/views/dialogs/Integratio
import IntegrationsDisabledDialog from "../components/views/dialogs/IntegrationsDisabledDialog";
import WidgetUtils from "../utils/WidgetUtils";
import { MatrixClientPeg } from "../MatrixClientPeg";
import { parseUrl } from "../utils/UrlUtils";

const KIND_PREFERENCE = [
// Ordered: first is most preferred, last is least preferred.
Expand Down Expand Up @@ -179,52 +178,6 @@ export class IntegrationManagers {
public showDisabledDialog(): void {
Modal.createDialog(IntegrationsDisabledDialog);
}

/**
* Attempts to discover an integration manager using only its name. This will not validate that
* the integration manager is functional - that is the caller's responsibility.
* @param {string} domainName The domain name to look up.
* @returns {Promise<IntegrationManagerInstance>} Resolves to an integration manager instance,
* or null if none was found.
*/
public async tryDiscoverManager(domainName: string): Promise<IntegrationManagerInstance | null> {
logger.log("Looking up integration manager via .well-known");
if (domainName.startsWith("http:") || domainName.startsWith("https:")) {
// trim off the scheme and just use the domain
domainName = parseUrl(domainName).host;
}

let wkConfig: IClientWellKnown;
try {
const result = await fetch(`https://${domainName}/.well-known/matrix/integrations`);
wkConfig = await result.json();
} catch (e) {
logger.error(e);
logger.warn("Failed to locate integration manager");
return null;
}

if (!wkConfig || !wkConfig["m.integrations_widget"]) {
logger.warn("Missing integrations widget on .well-known response");
return null;
}

const widget = wkConfig["m.integrations_widget"];
if (!widget["url"] || !widget["data"] || !widget["data"]["api_url"]) {
logger.warn("Malformed .well-known response for integrations widget");
return null;
}

// All discovered managers are per-user managers
const manager = new IntegrationManagerInstance(Kind.Account, widget["data"]["api_url"], widget["url"]);
logger.log("Got an integration manager (untested)");

// We don't test the manager because the caller may need to do extra
// checks or similar with it. For instance, they may need to deal with
// terms of service or want to call something particular.

return manager;
}
}

// For debugging
Expand Down
4 changes: 0 additions & 4 deletions src/mjolnir/BanList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export class BanList {
return this._rules.filter((r) => r.kind === RULE_USER);
}

public get roomRules(): ListRule[] {
return this._rules.filter((r) => r.kind === RULE_ROOM);
}

public async banEntity(kind: string, entity: string, reason: string): Promise<any> {
const type = ruleTypeToStable(kind);
if (!type) return; // unknown rule type
Expand Down
2 changes: 1 addition & 1 deletion src/models/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandler
this.emit(CallEvent.Participants, value, prevValue);
}

public constructor(
protected constructor(
/**
* The widget used to access this call.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/rageshake/submit-rageshake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
);

body.append("secret_storage_ready", String(await client.isSecretStorageReady()));
body.append("secret_storage_key_in_account", String(!!(await secretStorage.hasKey())));
body.append("secret_storage_key_in_account", String(await secretStorage.hasKey()));

body.append("session_backup_key_in_secret_storage", String(!!(await client.isKeyBackupKeyStored())));
const sessionBackupKeyFromCache = await client.crypto.getSessionBackupPrivateKey();
Expand Down
2 changes: 1 addition & 1 deletion src/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function getCryptoContext(client: MatrixClient): Promise<CryptoContext> {
!!(pkCache && (await pkCache.getCrossSigningKeyCache?.("user_signing"))),
),
secret_storage_ready: String(await client.isSecretStorageReady()),
secret_storage_key_in_account: String(!!(await secretStorage.hasKey())),
secret_storage_key_in_account: String(await secretStorage.hasKey()),
session_backup_key_in_secret_storage: String(!!(await client.isKeyBackupKeyStored())),
session_backup_key_cached: String(!!sessionBackupKeyFromCache),
session_backup_key_well_formed: String(sessionBackupKeyFromCache instanceof Uint8Array),
Expand Down
3 changes: 1 addition & 2 deletions src/stores/room-list/RoomListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,9 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
* @param {IFilterCondition} filter The filter condition to add.
*/
public async addFilter(filter: IFilterCondition): Promise<void> {
let promise = Promise.resolve();
filter.on(FILTER_CHANGED, this.onPrefilterUpdated);
this.prefilterConditions.push(filter);
promise = this.recalculatePrefiltering();
const promise = this.recalculatePrefiltering();
promise.then(() => this.updateFn.trigger());
}

Expand Down
2 changes: 0 additions & 2 deletions src/stores/room-list/SlidingRoomListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,4 @@ export class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> impl
}

protected async onAction(payload: ActionPayload): Promise<void> {}

protected async onDispatchAsync(payload: ActionPayload): Promise<void> {}
}
4 changes: 0 additions & 4 deletions src/stores/room-list/algorithms/Algorithm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ export class Algorithm extends EventEmitter {
return this._stickyRoom ? this._stickyRoom.room : null;
}

public get knownRooms(): Room[] {
return this.rooms;
}

public get hasTagSortingMap(): boolean {
return !!this.sortAlgorithms;
}
Expand Down
4 changes: 0 additions & 4 deletions src/stores/widgets/StopGapWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ export class StopGapWidget extends EventEmitter {
return parsed.toString().replace(/%24/g, "$");
}

public get isManagedByManager(): boolean {
return !!this.scalarToken;
}

public get started(): boolean {
return !!this.messaging;
}
Expand Down
Loading

0 comments on commit 40d7811

Please sign in to comment.