Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring develop to version 3.100.0 #73

Merged
merged 29 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
402e5db
Upgrade dependency to [email protected]
RiotRobot May 15, 2024
d84bcbc
v3.100.0-rc.0
RiotRobot May 15, 2024
4f3dcb6
Upgrade dependency to [email protected]
RiotRobot May 21, 2024
f712b80
Remove code smell assertion identified by Sonar (#12547)
EdGeraghty May 21, 2024
a29cabe
Report verification and recovery state to posthog (#12516)
BillCarsonFr May 21, 2024
a5e4daa
Deprecate `Tooltip.tsx`
florianduros May 21, 2024
7d3b3d7
Use tooltip compound in `MessageComposer.tsx`
florianduros May 21, 2024
dbe00e5
Use tooltip compound in `ReadReceiptGroup` component
florianduros May 21, 2024
25fa123
Use tooltip compound in `ReadReceiptPerson` component
florianduros May 22, 2024
67c7514
Delete `useTooltip.tsx`
florianduros May 22, 2024
a6907a0
Use compound tooltip in `ReactionRowButton`
florianduros May 22, 2024
0c28d37
Upgrade dependency to [email protected]
RiotRobot May 22, 2024
1190de9
Migrate `TooltipTarget` usage to compound `Tooltip` (#12542)
florianduros May 22, 2024
04741ae
Add tests for `ReadReceiptGroup.tsx`
florianduros May 22, 2024
b6132db
Merge branch 'develop' into florianduros/tooltip/legacy-tooltip
florianduros May 22, 2024
8f07672
Add more tests for `ReadReceiptGroup.tsx`
florianduros May 22, 2024
d9f718e
Add more test for `ReactionsRowButton.tsx`
florianduros May 22, 2024
88e8e2d
Merge pull request #12549 from matrix-org/florianduros/tooltip/legacy…
dbkr May 23, 2024
bc48fe4
Add seedrandom dep to `resolutions` (#12552)
richvdh May 23, 2024
1973197
[create-pull-request] automated change (#12554)
RiotRobot May 24, 2024
148a360
Avoid using deprecated exports, fields, and duplicate code (#12555)
t3chguy May 28, 2024
e8bb241
Fix tabbedview breakpoint width (#12556)
dbkr May 28, 2024
17ab522
Tooltip: close field tooltip when ESC is pressed (#12553)
florianduros May 28, 2024
679b170
Close the release announcement when a dialog is opened (#12559)
florianduros May 29, 2024
ca16462
Merge remote-tracking branch 'origin/develop' into staging
RiotRobot May 29, 2024
2e1c1d1
Upgrade dependency to [email protected]
RiotRobot May 29, 2024
7f49a30
v3.100.0-rc.1
RiotRobot May 29, 2024
f894ae6
Upgrade dependency to [email protected]
RiotRobot Jun 4, 2024
3ec0fe1
v3.100.0
RiotRobot Jun 4, 2024
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
Changes in [3.100.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.100.0) (2024-06-04)
=======================================================================================================
## ✨ Features

* Tooltip: Improve accessibility for context menus ([#12462](https://github.com/matrix-org/matrix-react-sdk/pull/12462)). Contributed by @florianduros.
* Tooltip: Improve accessibility of space panel ([#12525](https://github.com/matrix-org/matrix-react-sdk/pull/12525)). Contributed by @florianduros.

## 🐛 Bug Fixes

* Close the release announcement when a dialog is opened ([#12559](https://github.com/matrix-org/matrix-react-sdk/pull/12559)). Contributed by @florianduros.
* Tooltip: close field tooltip when ESC is pressed ([#12553](https://github.com/matrix-org/matrix-react-sdk/pull/12553)). Contributed by @florianduros.
* Fix tabbedview breakpoint width ([#12556](https://github.com/matrix-org/matrix-react-sdk/pull/12556)). Contributed by @dbkr.
* Fix E2E icon display in room header ([#12545](https://github.com/matrix-org/matrix-react-sdk/pull/12545)). Contributed by @florianduros.
* Tooltip: Improve placement for space settings ([#12541](https://github.com/matrix-org/matrix-react-sdk/pull/12541)). Contributed by @florianduros.
* Fix deformed avatar in a call in a narrow timeline ([#12538](https://github.com/matrix-org/matrix-react-sdk/pull/12538)). Contributed by @florianduros.
* Shown own sent state indicator even when showReadReceipts is disabled ([#12540](https://github.com/matrix-org/matrix-react-sdk/pull/12540)). Contributed by @t3chguy.
* Ensure we do not fire the verification mismatch modal multiple times ([#12526](https://github.com/matrix-org/matrix-react-sdk/pull/12526)). Contributed by @t3chguy.
* Fix avatar in chat export ([#12537](https://github.com/matrix-org/matrix-react-sdk/pull/12537)). Contributed by @florianduros.
* Use `*` for italics as it doesn't break when used mid-word ([#12523](https://github.com/matrix-org/matrix-react-sdk/pull/12523)). Contributed by @t3chguy.


Changes in [3.99.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.99.0) (2024-05-07)
=====================================================================================================
## ✨ Features
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
"version": "3.99.0",
"version": "3.100.0",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
Expand All @@ -23,7 +23,7 @@
"package.json",
".stylelintrc.js"
],
"main": "./src/index.ts",
"main": "./lib/index.ts",
"matrix_src_main": "./src/index.ts",
"matrix_lib_main": "./lib/index.ts",
"matrix_lib_typings": "./lib/index.d.ts",
Expand Down Expand Up @@ -62,12 +62,13 @@
"resolutions": {
"@types/react-dom": "17.0.25",
"@types/react": "17.0.80",
"@types/seedrandom": "3.0.4",
"oidc-client-ts": "3.0.1",
"jwt-decode": "4.0.0"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@matrix-org/analytics-events": "^0.20.0",
"@matrix-org/analytics-events": "^0.21.0",
"@matrix-org/emojibase-bindings": "^1.1.2",
"@matrix-org/matrix-wysiwyg": "2.17.0",
"@matrix-org/olm": "3.2.15",
Expand Down Expand Up @@ -109,7 +110,7 @@
"maplibre-gl": "^2.0.0",
"matrix-encrypt-attachment": "^1.0.3",
"matrix-events-sdk": "0.0.1",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-js-sdk": "33.0.0",
"matrix-widget-api": "^1.5.0",
"memoize-one": "^6.0.0",
"minimist": "^1.2.5",
Expand Down Expand Up @@ -183,7 +184,7 @@
"@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "2.11.0",
"@types/sdp-transform": "^2.4.6",
"@types/seedrandom": "<3.0.5",
"@types/seedrandom": "3.0.4",
"@types/tar-js": "^0.3.2",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^9.0.2",
Expand Down Expand Up @@ -235,5 +236,6 @@
"outputDirectory": "coverage",
"outputName": "jest-sonar-report.xml",
"relativePaths": true
}
},
"typings": "./lib/index.d.ts"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions res/css/components/views/elements/_AppPermission.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,3 @@ limitations under the License.
}
}
}

.mx_Tooltip.mx_Tooltip--appPermission {
box-shadow: none;
background-color: $tooltip-timeline-bg-color;
color: $tooltip-timeline-fg-color;
border: none;
border-radius: 3px;
padding: 6px 8px;

&.mx_Tooltip--appPermission--dark {
.mx_Tooltip_chevron::after {
border-right-color: $tooltip-timeline-bg-color;
}
}

ul {
list-style-position: inside;
padding-left: 2px;
margin-left: 0;
}
}
2 changes: 1 addition & 1 deletion res/css/structures/_TabbedView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ limitations under the License.
}

/* Hide the labels on tabs, showing only the icons, on narrow viewports. */
@media (max-width: 768px) {
@media (max-width: 1024px) {
.mx_TabbedView_tabsOnLeft.mx_TabbedView_responsive {
.mx_TabbedView_tabLabel_text {
display: none;
Expand Down
71 changes: 71 additions & 0 deletions src/DeviceListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import {
import { logger } from "matrix-js-sdk/src/logger";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { KeyBackupInfo } from "matrix-js-sdk/src/crypto-api";
import { CryptoSessionStateChange } from "@matrix-org/analytics-events/types/typescript/CryptoSessionStateChange";

import { PosthogAnalytics } from "./PosthogAnalytics";
import dis from "./dispatcher/dispatcher";
import {
hideToast as hideBulkUnverifiedSessionsToast,
Expand Down Expand Up @@ -79,6 +81,10 @@ export default class DeviceListener {
private enableBulkUnverifiedSessionsReminder = true;
private deviceClientInformationSettingWatcherRef: string | undefined;

// Remember the current analytics state to avoid sending the same event multiple times.
private analyticsVerificationState?: string;
private analyticsRecoveryState?: string;

public static sharedInstance(): DeviceListener {
if (!window.mxDeviceListener) window.mxDeviceListener = new DeviceListener();
return window.mxDeviceListener;
Expand Down Expand Up @@ -301,6 +307,7 @@ export default class DeviceListener {
const crossSigningReady = await crypto.isCrossSigningReady();
const secretStorageReady = await crypto.isSecretStorageReady();
const allSystemsReady = crossSigningReady && secretStorageReady;
await this.reportCryptoSessionStateToAnalytics(cli);

if (this.dismissedThisDeviceToast || allSystemsReady) {
hideSetupEncryptionToast();
Expand Down Expand Up @@ -407,6 +414,70 @@ export default class DeviceListener {
this.displayingToastsForDeviceIds = newUnverifiedDeviceIds;
}

/**
* Reports current recovery state to analytics.
* Checks if the session is verified and if the recovery is correctly set up (i.e all secrets known locally and in 4S).
* @param cli - the matrix client
* @private
*/
private async reportCryptoSessionStateToAnalytics(cli: MatrixClient): Promise<void> {
const crypto = cli.getCrypto()!;
const secretStorageReady = await crypto.isSecretStorageReady();
const crossSigningStatus = await crypto.getCrossSigningStatus();
const backupInfo = await this.getKeyBackupInfo();
const is4SEnabled = (await cli.secretStorage.getDefaultKeyId()) != null;
const deviceVerificationStatus = await crypto.getDeviceVerificationStatus(cli.getUserId()!, cli.getDeviceId()!);

const verificationState =
deviceVerificationStatus?.signedByOwner && deviceVerificationStatus?.crossSigningVerified
? "Verified"
: "NotVerified";

let recoveryState: "Disabled" | "Enabled" | "Incomplete";
if (!is4SEnabled) {
recoveryState = "Disabled";
} else {
const allCrossSigningSecretsCached =
crossSigningStatus.privateKeysCachedLocally.masterKey &&
crossSigningStatus.privateKeysCachedLocally.selfSigningKey &&
crossSigningStatus.privateKeysCachedLocally.userSigningKey;
if (backupInfo != null) {
// There is a backup. Check that all secrets are stored in 4S and known locally.
// If they are not, recovery is incomplete.
const backupPrivateKeyIsInCache = (await crypto.getSessionBackupPrivateKey()) != null;
if (secretStorageReady && allCrossSigningSecretsCached && backupPrivateKeyIsInCache) {
recoveryState = "Enabled";
} else {
recoveryState = "Incomplete";
}
} else {
// No backup. Just consider cross-signing secrets.
if (secretStorageReady && allCrossSigningSecretsCached) {
recoveryState = "Enabled";
} else {
recoveryState = "Incomplete";
}
}
}

if (this.analyticsVerificationState === verificationState && this.analyticsRecoveryState === recoveryState) {
// No changes, no need to send the event nor update the user properties
return;
}
this.analyticsRecoveryState = recoveryState;
this.analyticsVerificationState = verificationState;

// Update user properties
PosthogAnalytics.instance.setProperty("recoveryState", recoveryState);
PosthogAnalytics.instance.setProperty("verificationState", verificationState);

PosthogAnalytics.instance.trackEvent<CryptoSessionStateChange>({
eventName: "CryptoSessionState",
verificationState: verificationState,
recoveryState: recoveryState,
});
}

/**
* Check if key backup is enabled, and if not, raise an `Action.ReportKeyBackupNotEnabled` event (which will
* trigger an auto-rageshake).
Expand Down
17 changes: 0 additions & 17 deletions src/MatrixClientPeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ export interface IMatrixClientPeg {
*/
opts: IStartClientOpts;

/**
* Return the server name of the user's homeserver
* Throws an error if unable to deduce the homeserver name
* (e.g. if the user is not logged in)
*
* @returns {string} The homeserver name, if present.
*/
getHomeserverName(): string;

/**
* Get the current MatrixClient, if any
*/
Expand Down Expand Up @@ -384,14 +375,6 @@ class MatrixClientPegClass implements IMatrixClientPeg {
logger.log(`MatrixClientPeg: MatrixClient started`);
}

public getHomeserverName(): string {
const matches = /^@[^:]+:(.+)$/.exec(this.safeGet().getSafeUserId());
if (matches === null || matches.length < 1) {
throw new Error("Failed to derive homeserver name from user ID!");
}
return matches[1];
}

private namesToRoomName(names: string[], count: number): string | undefined {
const countWithoutMe = count - 1;
if (!names.length) {
Expand Down
11 changes: 11 additions & 0 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ interface IOptions<C extends ComponentType> {

export enum ModalManagerEvent {
Opened = "opened",
Closed = "closed",
}

type HandlerMap = {
[ModalManagerEvent.Opened]: () => void;
[ModalManagerEvent.Closed]: () => void;
};

export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMap> {
Expand Down Expand Up @@ -232,6 +234,7 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
}

this.reRender();
this.emitClosed();
},
deferred.promise,
];
Expand Down Expand Up @@ -328,6 +331,14 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
}
}

/**
* Emit the closed event
* @private
*/
private emitClosed(): void {
this.emit(ModalManagerEvent.Closed);
}

private onBackgroundClick = (): void => {
const modal = this.getCurrentModal();
if (!modal) {
Expand Down
10 changes: 2 additions & 8 deletions src/SecurityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import {
DeviceVerificationStatus,
ICryptoCallbacks,
MatrixClient,
encodeBase64,
SecretStorage,
} from "matrix-js-sdk/src/matrix";
import { Crypto, ICryptoCallbacks, MatrixClient, encodeBase64, SecretStorage } from "matrix-js-sdk/src/matrix";
import { deriveKey } from "matrix-js-sdk/src/crypto/key_passphrase";
import { decodeRecoveryKey } from "matrix-js-sdk/src/crypto/recoverykey";
import { logger } from "matrix-js-sdk/src/logger";
Expand Down Expand Up @@ -249,7 +243,7 @@ async function onSecretRequested(
deviceId: string,
requestId: string,
name: string,
deviceTrust: DeviceVerificationStatus,
deviceTrust: Crypto.DeviceVerificationStatus,
): Promise<string | undefined> {
logger.log("onSecretRequested", userId, deviceId, requestId, name, deviceTrust);
const client = MatrixClientPeg.safeGet();
Expand Down
8 changes: 6 additions & 2 deletions src/SlidingSyncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ export class SlidingSyncManager {
let proxyUrl: string | undefined;

try {
const clientWellKnown = await AutoDiscovery.findClientConfig(client.getDomain()!);
const clientDomain = await client.getDomain();
if (clientDomain === null) {
throw new RangeError("Homeserver domain is null");
}
const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain);
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
} catch (e) {
// client.getDomain() is invalid, `AutoDiscovery.findClientConfig` has thrown
// Either client.getDomain() is null so we've shorted out, or is invalid so `AutoDiscovery.findClientConfig` has thrown
}

if (proxyUrl != undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/CreateRoomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
</summary>
<LabelledToggleSwitch
label={_t("create_room|unfederated", {
serverName: MatrixClientPeg.getHomeserverName(),
serverName: MatrixClientPeg.safeGet().getDomain(),
})}
onChange={this.onNoFederateChange}
value={this.state.noFederate}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/ServerOfflineDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class ServerOfflineDialog extends React.PureComponent<IProps> {
timeline = [<div key={1}>{_t("server_offline|empty_timeline")}</div>];
}

const serverName = MatrixClientPeg.getHomeserverName();
const serverName = MatrixClientPeg.safeGet().getDomain();
return (
<BaseDialog
title={_t("server_offline|title")}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/devtools/ServerInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function getServerVersionFromFederationApi(client: MatrixClient): P
let baseUrl = client.getHomeserverUrl();

try {
const hsName = MatrixClientPeg.getHomeserverName();
const hsName = MatrixClientPeg.safeGet().getDomain();
// We don't use the js-sdk Autodiscovery module here as it only support client well-known, not server ones.
const response = await fetch(`https://${hsName}/.well-known/matrix/server`);
const json = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/directory/NetworkDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function useServers(): ServerList {
SettingLevel.ACCOUNT,
);

const homeServer = MatrixClientPeg.getHomeserverName();
const homeServer = MatrixClientPeg.safeGet().getDomain()!;
const configServers = new Set<string>(SdkConfig.getObject("room_directory")?.get("servers") ?? []);
removeAll(configServers, homeServer);
// configured servers take preference over user-defined ones, if one occurs in both ignore the latter one.
Expand Down
Loading
Loading