mirror of https://github.com/vector-im/riot-web
Merge branch 'master' into develop
commit
a7bc0e4612
93
CHANGELOG.md
93
CHANGELOG.md
|
@ -1,3 +1,96 @@
|
||||||
|
Changes in [3.105.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.105.1) (2024-08-06)
|
||||||
|
=======================================================================================================
|
||||||
|
Fixes for CVE-2024-42347 / GHSA-f83w-wqhc-cfp4
|
||||||
|
|
||||||
|
Changes in [3.105.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.105.0) (2024-08-06)
|
||||||
|
=======================================================================================================
|
||||||
|
Fixes for CVE-2024-42347 / GHSA-f83w-wqhc-cfp4
|
||||||
|
|
||||||
|
Changes in [3.104.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.104.0) (2024-07-30)
|
||||||
|
=======================================================================================================
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
* Add release announcement for the new room header ([#12802](https://github.com/matrix-org/matrix-react-sdk/pull/12802)). Contributed by @MidhunSureshR.
|
||||||
|
* Default the room header to on ([#12803](https://github.com/matrix-org/matrix-react-sdk/pull/12803)). Contributed by @MidhunSureshR.
|
||||||
|
* Update Thread Panel to match latest designs ([#12797](https://github.com/matrix-org/matrix-react-sdk/pull/12797)). Contributed by @t3chguy.
|
||||||
|
* Close any open modals on logout ([#12777](https://github.com/matrix-org/matrix-react-sdk/pull/12777)). Contributed by @dbkr.
|
||||||
|
* Iterate design of right panel empty state ([#12796](https://github.com/matrix-org/matrix-react-sdk/pull/12796)). Contributed by @t3chguy.
|
||||||
|
* Update styling of UserInfo right panel card ([#12788](https://github.com/matrix-org/matrix-react-sdk/pull/12788)). Contributed by @t3chguy.
|
||||||
|
* Accessibility: Add Landmark navigation ([#12190](https://github.com/matrix-org/matrix-react-sdk/pull/12190)). Contributed by @akirk.
|
||||||
|
* Let Element Call widget receive m.room.create ([#12710](https://github.com/matrix-org/matrix-react-sdk/pull/12710)). Contributed by @AndrewFerr.
|
||||||
|
* Let Element Call widget set session memberships ([#12713](https://github.com/matrix-org/matrix-react-sdk/pull/12713)). Contributed by @AndrewFerr.
|
||||||
|
* Update right panel base card styling to match Compound ([#12768](https://github.com/matrix-org/matrix-react-sdk/pull/12768)). Contributed by @t3chguy.
|
||||||
|
* Align `widget_build_url_ignore_dm` with call behaviour switch between 1:1 and Widget ([#12760](https://github.com/matrix-org/matrix-react-sdk/pull/12760)). Contributed by @t3chguy.
|
||||||
|
* Move integrations switch ([#12733](https://github.com/matrix-org/matrix-react-sdk/pull/12733)). Contributed by @dbkr.
|
||||||
|
* Element-R: Report events with withheld keys separately to Posthog. ([#12755](https://github.com/matrix-org/matrix-react-sdk/pull/12755)). Contributed by @richvdh.
|
||||||
|
|
||||||
|
## 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* Test for lack of WebAssembly support ([#12792](https://github.com/matrix-org/matrix-react-sdk/pull/12792)). Contributed by @dbkr.
|
||||||
|
* Fix stray 'account' heading ([#12791](https://github.com/matrix-org/matrix-react-sdk/pull/12791)). Contributed by @dbkr.
|
||||||
|
* Add test for the unsupported browser screen ([#12787](https://github.com/matrix-org/matrix-react-sdk/pull/12787)). Contributed by @dbkr.
|
||||||
|
* Fix HTML export test ([#12778](https://github.com/matrix-org/matrix-react-sdk/pull/12778)). Contributed by @dbkr.
|
||||||
|
* Fix HTML export missing a bunch of Compound variables ([#12774](https://github.com/matrix-org/matrix-react-sdk/pull/12774)). Contributed by @t3chguy.
|
||||||
|
* Fix inability to change accent colour consistently in custom theming ([#12772](https://github.com/matrix-org/matrix-react-sdk/pull/12772)). Contributed by @t3chguy.
|
||||||
|
* Fix edge case of landing on 3pid email link with registration disabled ([#12771](https://github.com/matrix-org/matrix-react-sdk/pull/12771)). Contributed by @t3chguy.
|
||||||
|
|
||||||
|
|
||||||
|
Changes in [3.103.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.103.0) (2024-07-16)
|
||||||
|
=======================================================================================================
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
* Add tabs to the right panel ([#12672](https://github.com/matrix-org/matrix-react-sdk/pull/12672)). Contributed by @MidhunSureshR.
|
||||||
|
* Promote new room header from labs to Beta ([#12739](https://github.com/matrix-org/matrix-react-sdk/pull/12739)). Contributed by @t3chguy.
|
||||||
|
* Redesign room search interface ([#12677](https://github.com/matrix-org/matrix-react-sdk/pull/12677)). Contributed by @t3chguy.
|
||||||
|
* Move language settings to 'preferences' ([#12723](https://github.com/matrix-org/matrix-react-sdk/pull/12723)). Contributed by @dbkr.
|
||||||
|
* New layout selector ui in user settings ([#12676](https://github.com/matrix-org/matrix-react-sdk/pull/12676)). Contributed by @florianduros.
|
||||||
|
* Prevent Element appearing in system media controls ([#10995](https://github.com/matrix-org/matrix-react-sdk/pull/10995)). Contributed by @SuperKenVery.
|
||||||
|
* Move the account management button ([#12663](https://github.com/matrix-org/matrix-react-sdk/pull/12663)). Contributed by @dbkr.
|
||||||
|
* Disable profile controls if the HS doesn't allow them to be set ([#12652](https://github.com/matrix-org/matrix-react-sdk/pull/12652)). Contributed by @dbkr.
|
||||||
|
* New theme ui in user settings ([#12576](https://github.com/matrix-org/matrix-react-sdk/pull/12576)). Contributed by @florianduros.
|
||||||
|
* Adjust room header hover transition from 300ms to 200ms ([#12703](https://github.com/matrix-org/matrix-react-sdk/pull/12703)). Contributed by @t3chguy.
|
||||||
|
* Split out email \& phone number settings to separate components \& move discovery to privacy tab ([#12670](https://github.com/matrix-org/matrix-react-sdk/pull/12670)). Contributed by @dbkr.
|
||||||
|
|
||||||
|
## 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* Fix incoming call toast crash due to audio refactor ([#12737](https://github.com/matrix-org/matrix-react-sdk/pull/12737)). Contributed by @t3chguy.
|
||||||
|
* Improve new room header accessibility ([#12725](https://github.com/matrix-org/matrix-react-sdk/pull/12725)). Contributed by @t3chguy.
|
||||||
|
* Fix closing all modals ([#12728](https://github.com/matrix-org/matrix-react-sdk/pull/12728)). Contributed by @dbkr.
|
||||||
|
* Fix close button on forgot password flow ([#12732](https://github.com/matrix-org/matrix-react-sdk/pull/12732)). Contributed by @dbkr.
|
||||||
|
* Don't consider textual characters to be emoji ([#12582](https://github.com/matrix-org/matrix-react-sdk/pull/12582)). Contributed by @robintown.
|
||||||
|
* Clear autocomplete input on selection accept ([#12709](https://github.com/matrix-org/matrix-react-sdk/pull/12709)). Contributed by @dbkr.
|
||||||
|
* Fix `Match system theme` toggle ([#12719](https://github.com/matrix-org/matrix-react-sdk/pull/12719)). Contributed by @florianduros.
|
||||||
|
|
||||||
|
|
||||||
|
Changes in [3.102.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.102.0) (2024-07-08)
|
||||||
|
=======================================================================================================
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
* Switch to Rust crypto stack for all logins ([#12630](https://github.com/matrix-org/matrix-react-sdk/pull/12630)). Contributed by @richvdh.
|
||||||
|
* Hide voip buttons in group rooms in environments with widgets disabled ([#12664](https://github.com/matrix-org/matrix-react-sdk/pull/12664)). Contributed by @t3chguy.
|
||||||
|
* Minor tweaks to UserSettings dialog ([#12651](https://github.com/matrix-org/matrix-react-sdk/pull/12651)). Contributed by @florianduros.
|
||||||
|
* Hide voice call button when redundant ([#12639](https://github.com/matrix-org/matrix-react-sdk/pull/12639)). Contributed by @t3chguy.
|
||||||
|
* Improve accessibility of the room summary card ([#12586](https://github.com/matrix-org/matrix-react-sdk/pull/12586)). Contributed by @t3chguy.
|
||||||
|
* Show tooltips on narrow tabbed views ([#12624](https://github.com/matrix-org/matrix-react-sdk/pull/12624)). Contributed by @dbkr.
|
||||||
|
* Update gfm.css to github-markdown-css ([#12613](https://github.com/matrix-org/matrix-react-sdk/pull/12613)). Contributed by @t3chguy.
|
||||||
|
* Cache e2eStatus to avoid concerning unencrypted flicker when changing rooms ([#12606](https://github.com/matrix-org/matrix-react-sdk/pull/12606)). Contributed by @t3chguy.
|
||||||
|
* Tweak copy for user verification toast ([#12605](https://github.com/matrix-org/matrix-react-sdk/pull/12605)). Contributed by @t3chguy.
|
||||||
|
* Support s tags for strikethrough for Matrix v1.10 ([#12604](https://github.com/matrix-org/matrix-react-sdk/pull/12604)). Contributed by @t3chguy.
|
||||||
|
|
||||||
|
## 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* Remove redundant copy in deactive uia modal ([#12668](https://github.com/matrix-org/matrix-react-sdk/pull/12668)). Contributed by @t3chguy.
|
||||||
|
* Fix high contrast theme in settings ([#12649](https://github.com/matrix-org/matrix-react-sdk/pull/12649)). Contributed by @florianduros.
|
||||||
|
* Fix background on live location sharing footer ([#12629](https://github.com/matrix-org/matrix-react-sdk/pull/12629)). Contributed by @t3chguy.
|
||||||
|
* Remove outdated iframe sandbox attribute ([#12633](https://github.com/matrix-org/matrix-react-sdk/pull/12633)). Contributed by @t3chguy.
|
||||||
|
* Remove stray setState which caused encryption state shields to flicker ([#12632](https://github.com/matrix-org/matrix-react-sdk/pull/12632)). Contributed by @t3chguy.
|
||||||
|
* Fix stray background colour on markdown body ([#12628](https://github.com/matrix-org/matrix-react-sdk/pull/12628)). Contributed by @t3chguy.
|
||||||
|
* Fix widgets not being cleaned up correctly. ([#12616](https://github.com/matrix-org/matrix-react-sdk/pull/12616)). Contributed by @toger5.
|
||||||
|
* Add in-progress view to display name EditInPlace ([#12609](https://github.com/matrix-org/matrix-react-sdk/pull/12609)). Contributed by @dbkr.
|
||||||
|
* Fix config override of other settings levels ([#12593](https://github.com/matrix-org/matrix-react-sdk/pull/12593)). Contributed by @langleyd.
|
||||||
|
* Don't show 'saved' on display name save error ([#12600](https://github.com/matrix-org/matrix-react-sdk/pull/12600)). Contributed by @dbkr.
|
||||||
|
|
||||||
|
|
||||||
Changes in [3.101.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.101.0) (2024-06-18)
|
Changes in [3.101.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.101.0) (2024-06-18)
|
||||||
=======================================================================================================
|
=======================================================================================================
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "matrix-react-sdk",
|
"name": "matrix-react-sdk",
|
||||||
"version": "3.101.0",
|
"version": "3.105.1",
|
||||||
"description": "SDK for matrix.org using React",
|
"description": "SDK for matrix.org using React",
|
||||||
"author": "matrix.org",
|
"author": "matrix.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
},
|
},
|
||||||
"main": "./src/index.ts",
|
"main": "./lib/index.ts",
|
||||||
"matrix_src_main": "./src/index.ts",
|
"matrix_src_main": "./src/index.ts",
|
||||||
"matrix_lib_main": "./lib/index.ts",
|
"matrix_lib_main": "./lib/index.ts",
|
||||||
"matrix_lib_typings": "./lib/index.d.ts",
|
"matrix_lib_typings": "./lib/index.d.ts",
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
"maplibre-gl": "^2.0.0",
|
"maplibre-gl": "^2.0.0",
|
||||||
"matrix-encrypt-attachment": "^1.0.3",
|
"matrix-encrypt-attachment": "^1.0.3",
|
||||||
"matrix-events-sdk": "0.0.1",
|
"matrix-events-sdk": "0.0.1",
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
"matrix-js-sdk": "34.2.0",
|
||||||
"matrix-widget-api": "^1.5.0",
|
"matrix-widget-api": "^1.5.0",
|
||||||
"memoize-one": "^6.0.0",
|
"memoize-one": "^6.0.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
|
@ -250,5 +250,6 @@
|
||||||
"outputDirectory": "coverage",
|
"outputDirectory": "coverage",
|
||||||
"outputName": "jest-sonar-report.xml",
|
"outputName": "jest-sonar-report.xml",
|
||||||
"relativePaths": true
|
"relativePaths": true
|
||||||
}
|
},
|
||||||
|
"typings": "./lib/index.d.ts"
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ dis.register((payload) => {
|
||||||
// If we unset the client and the component is updated, the render will fail and unmount everything.
|
// If we unset the client and the component is updated, the render will fail and unmount everything.
|
||||||
// (The module dialog closes and fires a `aria_unhide_main_app` that will trigger a re-render)
|
// (The module dialog closes and fires a `aria_unhide_main_app` that will trigger a re-render)
|
||||||
stopMatrixClient(false);
|
stopMatrixClient(false);
|
||||||
doSetLoggedIn(typed.credentials, true).catch((e) => {
|
doSetLoggedIn(typed.credentials, true, true).catch((e) => {
|
||||||
// XXX we might want to fire a new event here to let the app know that the login failed ?
|
// XXX we might want to fire a new event here to let the app know that the login failed ?
|
||||||
// The module api could use it to display a message to the user.
|
// The module api could use it to display a message to the user.
|
||||||
logger.warn("Failed to overwrite login", e);
|
logger.warn("Failed to overwrite login", e);
|
||||||
|
@ -208,6 +208,7 @@ export async function loadSession(opts: ILoadSessionOpts = {}): Promise<boolean>
|
||||||
guest: true,
|
guest: true,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
).then(() => true);
|
).then(() => true);
|
||||||
}
|
}
|
||||||
const success = await restoreFromLocalStorage({
|
const success = await restoreFromLocalStorage({
|
||||||
|
@ -465,6 +466,7 @@ function registerAsGuest(hsUrl: string, isUrl?: string, defaultDeviceDisplayName
|
||||||
guest: true,
|
guest: true,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
).then(() => true);
|
).then(() => true);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
@ -610,6 +612,7 @@ export async function restoreFromLocalStorage(opts?: { ignoreGuest?: boolean }):
|
||||||
freshLogin: freshLogin,
|
freshLogin: freshLogin,
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -663,7 +666,7 @@ export async function setLoggedIn(credentials: IMatrixClientCreds): Promise<Matr
|
||||||
logger.log("Pickle key not created");
|
logger.log("Pickle key not created");
|
||||||
}
|
}
|
||||||
|
|
||||||
return doSetLoggedIn(Object.assign({}, credentials, { pickleKey }), true);
|
return doSetLoggedIn(Object.assign({}, credentials, { pickleKey }), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -700,7 +703,7 @@ export async function hydrateSession(credentials: IMatrixClientCreds): Promise<M
|
||||||
(await PlatformPeg.get()?.getPickleKey(credentials.userId, credentials.deviceId)) ?? undefined;
|
(await PlatformPeg.get()?.getPickleKey(credentials.userId, credentials.deviceId)) ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return doSetLoggedIn(credentials, overwrite);
|
return doSetLoggedIn(credentials, overwrite, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -746,12 +749,17 @@ async function createOidcTokenRefresher(credentials: IMatrixClientCreds): Promis
|
||||||
* optionally clears localstorage, persists new credentials
|
* optionally clears localstorage, persists new credentials
|
||||||
* to localstorage, starts the new client.
|
* to localstorage, starts the new client.
|
||||||
*
|
*
|
||||||
* @param {IMatrixClientCreds} credentials
|
* @param {IMatrixClientCreds} credentials The credentials to use
|
||||||
* @param {Boolean} clearStorageEnabled
|
* @param {Boolean} clearStorageEnabled True to clear storage before starting the new client
|
||||||
|
* @param {Boolean} isFreshLogin True if this is a fresh login, false if it is previous session being restored
|
||||||
*
|
*
|
||||||
* @returns {Promise} promise which resolves to the new MatrixClient once it has been started
|
* @returns {Promise} promise which resolves to the new MatrixClient once it has been started
|
||||||
*/
|
*/
|
||||||
async function doSetLoggedIn(credentials: IMatrixClientCreds, clearStorageEnabled: boolean): Promise<MatrixClient> {
|
async function doSetLoggedIn(
|
||||||
|
credentials: IMatrixClientCreds,
|
||||||
|
clearStorageEnabled: boolean,
|
||||||
|
isFreshLogin: boolean,
|
||||||
|
): Promise<MatrixClient> {
|
||||||
checkSessionLock();
|
checkSessionLock();
|
||||||
credentials.guest = Boolean(credentials.guest);
|
credentials.guest = Boolean(credentials.guest);
|
||||||
|
|
||||||
|
@ -840,6 +848,9 @@ async function doSetLoggedIn(credentials: IMatrixClientCreds, clearStorageEnable
|
||||||
clientPegOpts.rustCryptoStoreKey?.fill(0);
|
clientPegOpts.rustCryptoStoreKey?.fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run the migrations after the MatrixClientPeg has been assigned
|
||||||
|
SettingsStore.runMigrations(isFreshLogin);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,9 +1032,6 @@ async function startMatrixClient(
|
||||||
|
|
||||||
checkSessionLock();
|
checkSessionLock();
|
||||||
|
|
||||||
// Run the migrations after the MatrixClientPeg has been assigned
|
|
||||||
SettingsStore.runMigrations();
|
|
||||||
|
|
||||||
// This needs to be started after crypto is set up
|
// This needs to be started after crypto is set up
|
||||||
DeviceListener.sharedInstance().start(client);
|
DeviceListener.sharedInstance().start(client);
|
||||||
// Similarly, don't start sending presence updates until we've started
|
// Similarly, don't start sending presence updates until we've started
|
||||||
|
@ -1165,5 +1173,6 @@ window.mxLoginWithAccessToken = async (hsUrl: string, accessToken: string): Prom
|
||||||
userId,
|
userId,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default class UrlPreviewSettings extends React.Component<IProps> {
|
||||||
(
|
(
|
||||||
<SettingsFlag
|
<SettingsFlag
|
||||||
name={isEncrypted ? "urlPreviewsEnabled_e2ee" : "urlPreviewsEnabled"}
|
name={isEncrypted ? "urlPreviewsEnabled_e2ee" : "urlPreviewsEnabled"}
|
||||||
level={SettingLevel.ROOM_ACCOUNT}
|
level={SettingLevel.ROOM_DEVICE}
|
||||||
roomId={roomId}
|
roomId={roomId}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -900,7 +900,7 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
||||||
controller: new UIFeatureController(UIFeature.URLPreviews),
|
controller: new UIFeatureController(UIFeature.URLPreviews),
|
||||||
},
|
},
|
||||||
"urlPreviewsEnabled_e2ee": {
|
"urlPreviewsEnabled_e2ee": {
|
||||||
supportedLevels: [SettingLevel.ROOM_DEVICE, SettingLevel.ROOM_ACCOUNT],
|
supportedLevels: [SettingLevel.ROOM_DEVICE],
|
||||||
displayName: {
|
displayName: {
|
||||||
"room-account": _td("settings|inline_url_previews_room_account"),
|
"room-account": _td("settings|inline_url_previews_room_account"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
|
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
|
import { ClientEvent, SyncState } from "matrix-js-sdk/src/matrix";
|
||||||
|
|
||||||
import DeviceSettingsHandler from "./handlers/DeviceSettingsHandler";
|
import DeviceSettingsHandler from "./handlers/DeviceSettingsHandler";
|
||||||
import RoomDeviceSettingsHandler from "./handlers/RoomDeviceSettingsHandler";
|
import RoomDeviceSettingsHandler from "./handlers/RoomDeviceSettingsHandler";
|
||||||
|
@ -36,6 +37,7 @@ import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayl
|
||||||
import { Action } from "../dispatcher/actions";
|
import { Action } from "../dispatcher/actions";
|
||||||
import PlatformSettingsHandler from "./handlers/PlatformSettingsHandler";
|
import PlatformSettingsHandler from "./handlers/PlatformSettingsHandler";
|
||||||
import ReloadOnChangeController from "./controllers/ReloadOnChangeController";
|
import ReloadOnChangeController from "./controllers/ReloadOnChangeController";
|
||||||
|
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||||
|
|
||||||
// Convert the settings to easier to manage objects for the handlers
|
// Convert the settings to easier to manage objects for the handlers
|
||||||
const defaultSettings: Record<string, any> = {};
|
const defaultSettings: Record<string, any> = {};
|
||||||
|
@ -637,10 +639,61 @@ export default class SettingsStore {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate the setting for URL previews in e2e rooms from room account
|
||||||
|
* data to the room device level.
|
||||||
|
*
|
||||||
|
* @param isFreshLogin True if the user has just logged in, false if a previous session is being restored.
|
||||||
|
*/
|
||||||
|
private static async migrateURLPreviewsE2EE(isFreshLogin: boolean): Promise<void> {
|
||||||
|
const MIGRATION_DONE_FLAG = "url_previews_e2ee_migration_done";
|
||||||
|
if (localStorage.getItem(MIGRATION_DONE_FLAG)) return;
|
||||||
|
if (isFreshLogin) return;
|
||||||
|
|
||||||
|
const client = MatrixClientPeg.safeGet();
|
||||||
|
|
||||||
|
const doMigration = async (): Promise<void> => {
|
||||||
|
logger.info("Performing one-time settings migration of URL previews in E2EE rooms");
|
||||||
|
|
||||||
|
const roomAccounthandler = LEVEL_HANDLERS[SettingLevel.ROOM_ACCOUNT];
|
||||||
|
|
||||||
|
for (const room of client.getRooms()) {
|
||||||
|
// We need to use the handler directly because this setting is no longer supported
|
||||||
|
// at this level at all
|
||||||
|
const val = roomAccounthandler.getValue("urlPreviewsEnabled_e2ee", room.roomId);
|
||||||
|
|
||||||
|
if (val !== undefined) {
|
||||||
|
await SettingsStore.setValue("urlPreviewsEnabled_e2ee", room.roomId, SettingLevel.ROOM_DEVICE, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem(MIGRATION_DONE_FLAG, "true");
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSync = (state: SyncState): void => {
|
||||||
|
if (state === SyncState.Prepared) {
|
||||||
|
client.removeListener(ClientEvent.Sync, onSync);
|
||||||
|
|
||||||
|
doMigration().catch((e) => {
|
||||||
|
logger.error("Failed to migrate URL previews in E2EE rooms:", e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
client.on(ClientEvent.Sync, onSync);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs or queues any setting migrations needed.
|
* Runs or queues any setting migrations needed.
|
||||||
*/
|
*/
|
||||||
public static runMigrations(): void {
|
public static runMigrations(isFreshLogin: boolean): void {
|
||||||
|
// This can be removed once enough users have run a version of Element with
|
||||||
|
// this migration. A couple of months after its release should be sufficient
|
||||||
|
// (so around October 2024).
|
||||||
|
// The consequences of missing the migration are only that URL previews will
|
||||||
|
// be disabled in E2EE rooms.
|
||||||
|
SettingsStore.migrateURLPreviewsE2EE(isFreshLogin);
|
||||||
|
|
||||||
// Dev notes: to add your migration, just add a new `migrateMyFeature` function, call it, and
|
// Dev notes: to add your migration, just add a new `migrateMyFeature` function, call it, and
|
||||||
// add a comment to note when it can be removed.
|
// add a comment to note when it can be removed.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,11 +14,13 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ClientEvent, MatrixClient, Room, SyncState } from "matrix-js-sdk/src/matrix";
|
||||||
|
|
||||||
import BasePlatform from "../../src/BasePlatform";
|
import BasePlatform from "../../src/BasePlatform";
|
||||||
import SdkConfig from "../../src/SdkConfig";
|
import SdkConfig from "../../src/SdkConfig";
|
||||||
import { SettingLevel } from "../../src/settings/SettingLevel";
|
import { SettingLevel } from "../../src/settings/SettingLevel";
|
||||||
import SettingsStore from "../../src/settings/SettingsStore";
|
import SettingsStore from "../../src/settings/SettingsStore";
|
||||||
import { mockPlatformPeg } from "../test-utils";
|
import { mkStubRoom, mockPlatformPeg, stubClient } from "../test-utils";
|
||||||
|
|
||||||
const TEST_DATA = [
|
const TEST_DATA = [
|
||||||
{
|
{
|
||||||
|
@ -84,4 +86,65 @@ describe("SettingsStore", () => {
|
||||||
expect(SettingsStore.getValueAt(SettingLevel.DEVICE, SETTING_NAME_WITH_CONFIG_OVERRIDE)).toBe(true);
|
expect(SettingsStore.getValueAt(SettingLevel.DEVICE, SETTING_NAME_WITH_CONFIG_OVERRIDE)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("runMigrations", () => {
|
||||||
|
let client: MatrixClient;
|
||||||
|
let room: Room;
|
||||||
|
let localStorageSetItemSpy: jest.SpyInstance;
|
||||||
|
let localStorageSetPromise: Promise<void>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
client = stubClient();
|
||||||
|
room = mkStubRoom("!room:example.org", "Room", client);
|
||||||
|
room.getAccountData = jest.fn().mockReturnValue({
|
||||||
|
getContent: jest.fn().mockReturnValue({
|
||||||
|
urlPreviewsEnabled_e2ee: true,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
client.getRooms = jest.fn().mockReturnValue([room]);
|
||||||
|
client.getRoom = jest.fn().mockReturnValue(room);
|
||||||
|
|
||||||
|
localStorageSetPromise = new Promise((resolve) => {
|
||||||
|
localStorageSetItemSpy = jest
|
||||||
|
.spyOn(localStorage.__proto__, "setItem")
|
||||||
|
.mockImplementation(() => resolve());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("migrates URL previews setting for e2ee rooms", async () => {
|
||||||
|
SettingsStore.runMigrations(false);
|
||||||
|
client.emit(ClientEvent.Sync, SyncState.Prepared, null);
|
||||||
|
|
||||||
|
expect(room.getAccountData).toHaveBeenCalled();
|
||||||
|
|
||||||
|
await localStorageSetPromise;
|
||||||
|
|
||||||
|
expect(localStorageSetItemSpy!).toHaveBeenCalledWith(
|
||||||
|
`mx_setting_urlPreviewsEnabled_e2ee_${room.roomId}`,
|
||||||
|
JSON.stringify({ value: true }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not migrate e2ee URL previews on a fresh login", async () => {
|
||||||
|
SettingsStore.runMigrations(true);
|
||||||
|
client.emit(ClientEvent.Sync, SyncState.Prepared, null);
|
||||||
|
|
||||||
|
expect(room.getAccountData).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not migrate if the device is flagged as migrated", async () => {
|
||||||
|
jest.spyOn(localStorage.__proto__, "getItem").mockImplementation((key: unknown): string | undefined => {
|
||||||
|
if (key === "url_previews_e2ee_migration_done") return JSON.stringify({ value: true });
|
||||||
|
return undefined;
|
||||||
|
});
|
||||||
|
SettingsStore.runMigrations(false);
|
||||||
|
client.emit(ClientEvent.Sync, SyncState.Prepared, null);
|
||||||
|
|
||||||
|
expect(room.getAccountData).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1855,6 +1855,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-2.37.4.tgz#bd9b46051a21c9986477e3a83a1417b1ee926d81"
|
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-2.37.4.tgz#bd9b46051a21c9986477e3a83a1417b1ee926d81"
|
||||||
integrity sha512-4OtBWAHNAOu9P5C6jOIeHlu4ChwV2YusxnbGuN20IceC4bT2h38flZQgm0x9/jgHfF0LwnKUwKXsxtRoq8xW0g==
|
integrity sha512-4OtBWAHNAOu9P5C6jOIeHlu4ChwV2YusxnbGuN20IceC4bT2h38flZQgm0x9/jgHfF0LwnKUwKXsxtRoq8xW0g==
|
||||||
|
|
||||||
|
"@matrix-org/olm@3.2.15":
|
||||||
|
version "3.2.15"
|
||||||
|
resolved "https://registry.yarnpkg.com/@matrix-org/olm/-/olm-3.2.15.tgz#55f3c1b70a21bbee3f9195cecd6846b1083451ec"
|
||||||
|
integrity sha512-S7lOrndAK9/8qOtaTq/WhttJC/o4GAzdfK0MUPpo8ApzsJEC0QjtwrkC3KBXdFP1cD1MXi/mlKR7aaoVMKgs6Q==
|
||||||
|
|
||||||
"@matrix-org/react-sdk-module-api@^2.4.0":
|
"@matrix-org/react-sdk-module-api@^2.4.0":
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@matrix-org/react-sdk-module-api/-/react-sdk-module-api-2.4.0.tgz#5e4552acbe728141f42c1d54d75dcb4efea9301c"
|
resolved "https://registry.yarnpkg.com/@matrix-org/react-sdk-module-api/-/react-sdk-module-api-2.4.0.tgz#5e4552acbe728141f42c1d54d75dcb4efea9301c"
|
||||||
|
|
Loading…
Reference in New Issue