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 florianduros/fix/new-line-rte
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Jan 18, 2023
2 parents f6b5532 + 4d2b27a commit e500964
Show file tree
Hide file tree
Showing 14 changed files with 421 additions and 58 deletions.
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
Changes in [3.64.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.64.0) (2023-01-18)
=====================================================================================================

## ✨ Features
* Switch threads on for everyone ([\#9879](https://github.com/matrix-org/matrix-react-sdk/pull/9879)).
* Make threads use new UTD UI ([\#9876](https://github.com/matrix-org/matrix-react-sdk/pull/9876)). Fixes vector-im/element-web#24060.
* Add edit and remove actions to link in RTE ([\#9864](https://github.com/matrix-org/matrix-react-sdk/pull/9864)).
* Remove extensible events v1 experimental rendering ([\#9881](https://github.com/matrix-org/matrix-react-sdk/pull/9881)).
* Make create poll dialog scale better (PSG-929) ([\#9873](https://github.com/matrix-org/matrix-react-sdk/pull/9873)). Fixes vector-im/element-web#21855.
* Change RTE mode icons ([\#9861](https://github.com/matrix-org/matrix-react-sdk/pull/9861)).
* Device manager - prune client information events after remote sign out ([\#9874](https://github.com/matrix-org/matrix-react-sdk/pull/9874)).
* Check connection before starting broadcast ([\#9857](https://github.com/matrix-org/matrix-react-sdk/pull/9857)).
* Enable sent receipt for poll start events (PSG-962) ([\#9870](https://github.com/matrix-org/matrix-react-sdk/pull/9870)).
* Change clear notifications to have more readable copy ([\#9867](https://github.com/matrix-org/matrix-react-sdk/pull/9867)).
* Combine search results when the query is present in multiple successive messages ([\#9855](https://github.com/matrix-org/matrix-react-sdk/pull/9855)). Fixes vector-im/element-web#3977. Contributed by @grimhilt.
* Disable bubbles for broadcasts ([\#9860](https://github.com/matrix-org/matrix-react-sdk/pull/9860)). Fixes vector-im/element-web#24140.
* Enable reactions and replies for broadcasts ([\#9856](https://github.com/matrix-org/matrix-react-sdk/pull/9856)). Fixes vector-im/element-web#24042.
* Improve switching between rich and plain editing modes ([\#9776](https://github.com/matrix-org/matrix-react-sdk/pull/9776)).
* Redesign the picture-in-picture window ([\#9800](https://github.com/matrix-org/matrix-react-sdk/pull/9800)). Fixes vector-im/element-web#23980.
* User on-boarding tasks now appear in a static order. ([\#9799](https://github.com/matrix-org/matrix-react-sdk/pull/9799)). Contributed by @GoodGuyMarco.
* Device manager - contextual menus ([\#9832](https://github.com/matrix-org/matrix-react-sdk/pull/9832)).
* If listening a non-live broadcast and changing the room, the broadcast will be paused ([\#9825](https://github.com/matrix-org/matrix-react-sdk/pull/9825)). Fixes vector-im/element-web#24078.
* Consider own broadcasts from other device as a playback ([\#9821](https://github.com/matrix-org/matrix-react-sdk/pull/9821)). Fixes vector-im/element-web#24068.
* Add link creation to rich text editor ([\#9775](https://github.com/matrix-org/matrix-react-sdk/pull/9775)).
* Add mark as read option in room setting ([\#9798](https://github.com/matrix-org/matrix-react-sdk/pull/9798)). Fixes vector-im/element-web#24053.
* Device manager - current device design and copy tweaks ([\#9801](https://github.com/matrix-org/matrix-react-sdk/pull/9801)).
* Unify notifications panel event design ([\#9754](https://github.com/matrix-org/matrix-react-sdk/pull/9754)).
* Add actions for integration manager to send and read certain events ([\#9740](https://github.com/matrix-org/matrix-react-sdk/pull/9740)).
* Device manager - design tweaks ([\#9768](https://github.com/matrix-org/matrix-react-sdk/pull/9768)).
* Change room list sorting to activity and unread first by default ([\#9773](https://github.com/matrix-org/matrix-react-sdk/pull/9773)). Fixes vector-im/element-web#24014.
* Add a config flag to enable the rust crypto-sdk ([\#9759](https://github.com/matrix-org/matrix-react-sdk/pull/9759)).
* Improve decryption error UI by consolidating error messages and providing instructions when possible ([\#9544](https://github.com/matrix-org/matrix-react-sdk/pull/9544)).
* Honor font settings in Element Call ([\#9751](https://github.com/matrix-org/matrix-react-sdk/pull/9751)). Fixes vector-im/element-web#23661.
* Device manager - use deleteAccountData to prune device manager client information events ([\#9734](https://github.com/matrix-org/matrix-react-sdk/pull/9734)).

## 🐛 Bug Fixes
* Display rooms & threads as unread (bold) if threads have unread messages. ([\#9763](https://github.com/matrix-org/matrix-react-sdk/pull/9763)). Fixes vector-im/element-web#23907.
* Don't prefer STIXGeneral over the default font ([\#9711](https://github.com/matrix-org/matrix-react-sdk/pull/9711)). Fixes vector-im/element-web#23899.
* Use the same avatar colour when creating 1:1 DM rooms ([\#9850](https://github.com/matrix-org/matrix-react-sdk/pull/9850)). Fixes vector-im/element-web#23476.
* Fix space lock icon size ([\#9854](https://github.com/matrix-org/matrix-react-sdk/pull/9854)). Fixes vector-im/element-web#24128.
* Make calls automatically disconnect if the widget disappears ([\#9862](https://github.com/matrix-org/matrix-react-sdk/pull/9862)). Fixes vector-im/element-web#23664.
* Fix emoji in RTE editing ([\#9827](https://github.com/matrix-org/matrix-react-sdk/pull/9827)).
* Fix export with attachments on formats txt and json ([\#9851](https://github.com/matrix-org/matrix-react-sdk/pull/9851)). Fixes vector-im/element-web#24130. Contributed by @grimhilt.
* Fixed empty `Content-Type` for encrypted uploads ([\#9848](https://github.com/matrix-org/matrix-react-sdk/pull/9848)). Contributed by @K3das.
* Fix sign-in instead link on password reset page ([\#9820](https://github.com/matrix-org/matrix-react-sdk/pull/9820)). Fixes vector-im/element-web#24087.
* The seekbar now initially shows the current position ([\#9796](https://github.com/matrix-org/matrix-react-sdk/pull/9796)). Fixes vector-im/element-web#24051.
* Fix: Editing a poll will silently change it to a closed poll ([\#9809](https://github.com/matrix-org/matrix-react-sdk/pull/9809)). Fixes vector-im/element-web#23176.
* Make call tiles look less broken in the right panel ([\#9808](https://github.com/matrix-org/matrix-react-sdk/pull/9808)). Fixes vector-im/element-web#23716.
* Prevent unnecessary m.direct updates ([\#9805](https://github.com/matrix-org/matrix-react-sdk/pull/9805)). Fixes vector-im/element-web#24059.
* Fix checkForPreJoinUISI for thread roots ([\#9803](https://github.com/matrix-org/matrix-react-sdk/pull/9803)). Fixes vector-im/element-web#24054.
* Snap in PiP widget when content changed ([\#9797](https://github.com/matrix-org/matrix-react-sdk/pull/9797)). Fixes vector-im/element-web#24050.
* Load RTE components only when RTE labs is enabled ([\#9804](https://github.com/matrix-org/matrix-react-sdk/pull/9804)).
* Ensure that events are correctly updated when they are edited. ([\#9789](https://github.com/matrix-org/matrix-react-sdk/pull/9789)).
* When stopping a broadcast also stop the playback ([\#9795](https://github.com/matrix-org/matrix-react-sdk/pull/9795)). Fixes vector-im/element-web#24052.
* Prevent to start two broadcasts at the same time ([\#9744](https://github.com/matrix-org/matrix-react-sdk/pull/9744)). Fixes vector-im/element-web#23973.
* Correctly handle limited sync responses by resetting the thread timeline ([\#3056](https://github.com/matrix-org/matrix-js-sdk/pull/3056)). Fixes vector-im/element-web#23952.
* Fix failure to start in firefox private browser ([\#3058](https://github.com/matrix-org/matrix-js-sdk/pull/3058)). Fixes vector-im/element-web#24216.

Changes in [3.63.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.63.0) (2022-12-21)
=====================================================================================================

Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/composer/composer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ describe("Composer", () => {
cy.contains(".mx_EventTile_body", "my message 1");
});

it("sends only one message when you press Enter multiple times", () => {
// Type a message
cy.get("div[contenteditable=true]").type("my message 0");
// It has not been sent yet
cy.contains(".mx_EventTile_body", "my message 0").should("not.exist");

// Click send
cy.get("div[contenteditable=true]").type("{enter}");
cy.get("div[contenteditable=true]").type("{enter}");
cy.get("div[contenteditable=true]").type("{enter}");
// It has been sent
cy.contains(".mx_EventTile_body", "my message 0");
cy.get(".mx_EventTile_body").should("have.length", 1);
});

it("can write formatted text", () => {
cy.get("div[contenteditable=true]").type("my {ctrl+b}bold{ctrl+b} message");
cy.get('div[aria-label="Send message"]').click();
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.63.0",
"version": "3.64.0",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
Expand Down
11 changes: 10 additions & 1 deletion res/css/views/rooms/_EventTile.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ $left-gutter: 64px;

&::before {
inset: 0;
pointer-events: none; /* ensures the title for the sender name can be correctly displayed */
}

/* Display notification dot */
Expand Down Expand Up @@ -927,8 +928,14 @@ $left-gutter: 64px;
inset: $padding auto auto $padding;
}

.mx_EventTile_details {
overflow: hidden;
}

.mx_DisambiguatedProfile {
display: inline-flex;
align-items: center;
flex: 1;

.mx_DisambiguatedProfile_displayName,
.mx_DisambiguatedProfile_mxid {
Expand Down Expand Up @@ -979,7 +986,9 @@ $left-gutter: 64px;

.mx_MessageTimestamp {
font-size: $font-12px;
max-width: var(--MessageTimestamp-max-width);
width: unset; /* Cancel the default width */
overflow: hidden; /* ensure correct overflow behavior */
text-overflow: ellipsis;
position: initial;
margin-left: auto; /* to ensure it's end-aligned even if it's the only element of its parent */
}
Expand Down
34 changes: 22 additions & 12 deletions src/components/views/messages/DisambiguatedProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
Copyright 2022 The Matrix.org Foundation C.I.C.
Copyright 2022-2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@ import React from "react";
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import classNames from "classnames";

import { _t } from "../../../languageHandler";
import { getUserNameColorClass } from "../../../utils/FormattingUtils";
import UserIdentifier from "../../../customisations/UserIdentifier";

Expand All @@ -28,35 +29,44 @@ interface IProps {
onClick?(): void;
colored?: boolean;
emphasizeDisplayName?: boolean;
withTooltip?: boolean;
}

export default class DisambiguatedProfile extends React.Component<IProps> {
public render(): JSX.Element {
const { fallbackName, member, colored, emphasizeDisplayName, onClick } = this.props;
const { fallbackName, member, colored, emphasizeDisplayName, withTooltip, onClick } = this.props;
const rawDisplayName = member?.rawDisplayName || fallbackName;
const mxid = member?.userId;

let colorClass;
let colorClass: string | undefined;
if (colored) {
colorClass = getUserNameColorClass(fallbackName);
}

let mxidElement;
if (member?.disambiguate && mxid) {
mxidElement = (
<span className="mx_DisambiguatedProfile_mxid">
{UserIdentifier.getDisplayUserIdentifier(mxid, { withDisplayName: true, roomId: member.roomId })}
</span>
);
let title: string | undefined;

if (mxid) {
const identifier =
UserIdentifier.getDisplayUserIdentifier?.(mxid, {
withDisplayName: true,
roomId: member.roomId,
}) ?? mxid;
if (member?.disambiguate) {
mxidElement = <span className="mx_DisambiguatedProfile_mxid">{identifier}</span>;
}
title = _t("%(displayName)s (%(matrixId)s)", {
displayName: rawDisplayName,
matrixId: identifier,
});
}

const displayNameClasses = classNames({
const displayNameClasses = classNames(colorClass, {
mx_DisambiguatedProfile_displayName: emphasizeDisplayName,
[colorClass]: true,
});

return (
<div className="mx_DisambiguatedProfile" onClick={onClick}>
<div className="mx_DisambiguatedProfile" title={withTooltip ? title : undefined} onClick={onClick}>
<span className={displayNameClasses} dir="auto">
{rawDisplayName}
</span>
Expand Down
5 changes: 4 additions & 1 deletion src/components/views/messages/SenderProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Copyright 2023 The Matrix.org Foundation C.I.C.
Copyright 2015, 2016 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -24,9 +25,10 @@ import { useRoomMemberProfile } from "../../../hooks/room/useRoomMemberProfile";
interface IProps {
mxEvent: MatrixEvent;
onClick?(): void;
withTooltip?: boolean;
}

export default function SenderProfile({ mxEvent, onClick }: IProps): JSX.Element {
export default function SenderProfile({ mxEvent, onClick, withTooltip }: IProps): JSX.Element {
const member = useRoomMemberProfile({
userId: mxEvent.getSender(),
member: mxEvent.sender,
Expand All @@ -39,6 +41,7 @@ export default function SenderProfile({ mxEvent, onClick }: IProps): JSX.Element
member={member}
colored={true}
emphasizeDisplayName={true}
withTooltip={withTooltip}
/>
) : null;
}
4 changes: 3 additions & 1 deletion src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2015 - 2022 The Matrix.org Foundation C.I.C.
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -1091,6 +1091,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
this.context.timelineRenderingType === TimelineRenderingType.Thread
) {
sender = <SenderProfile onClick={this.onSenderProfileClick} mxEvent={this.props.mxEvent} />;
} else if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) {
sender = <SenderProfile mxEvent={this.props.mxEvent} withTooltip />;
} else {
sender = <SenderProfile mxEvent={this.props.mxEvent} />;
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/rooms/MessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,16 @@ export class MessageComposer extends React.Component<IProps, IState> {

if (this.state.isWysiwygLabEnabled) {
const { permalinkCreator, relation, replyToEvent } = this.props;
await sendMessage(this.state.composerContent, this.state.isRichTextEnabled, {
const composerContent = this.state.composerContent;
this.setState({ composerContent: "", initialComposerContent: "" });
await sendMessage(composerContent, this.state.isRichTextEnabled, {
mxClient: this.props.mxClient,
roomContext: this.context,
permalinkCreator,
relation,
replyToEvent,
});
dis.dispatch({ action: Action.ClearAndFocusSendMessageComposer });
this.setState({ composerContent: "", initialComposerContent: "" });
}
};

Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2316,6 +2316,7 @@
"Last month": "Last month",
"The beginning of the room": "The beginning of the room",
"Jump to date": "Jump to date",
"%(displayName)s (%(matrixId)s)": "%(displayName)s (%(matrixId)s)",
"Downloading": "Downloading",
"Decrypting": "Decrypting",
"Download": "Download",
Expand Down
4 changes: 2 additions & 2 deletions src/stores/widgets/WidgetLayoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
widgets.forEach((w, i) => {
localLayout[w.id] = {
container: container,
width: widths[i],
width: widths?.[i],
index: i,
height: height,
};
Expand All @@ -437,7 +437,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
widgets.forEach((w, i) => {
localLayout[w.id] = {
container: container,
width: widths[i],
width: widths?.[i],
index: i,
height: height,
};
Expand Down
56 changes: 42 additions & 14 deletions test/settings/handlers/RoomDeviceSettingsHandler-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,49 @@ limitations under the License.
*/

import RoomDeviceSettingsHandler from "../../../src/settings/handlers/RoomDeviceSettingsHandler";
import { WatchManager } from "../../../src/settings/WatchManager";
import { SettingLevel } from "../../../src/settings/SettingLevel";
import { CallbackFn, WatchManager } from "../../../src/settings/WatchManager";

describe("RoomDeviceSettingsHandler", () => {
it("should correctly read cached values", () => {
const watchers = new WatchManager();
const handler = new RoomDeviceSettingsHandler(watchers);

const settingName = "RightPanel.phases";
const roomId = "!room:server";
const value = {
isOpen: true,
history: [{}],
};

handler.setValue(settingName, roomId, value);
expect(handler.getValue(settingName, roomId)).toEqual(value);
const roomId = "!room:example.com";
const value = "test value";
const testSettings = [
"RightPanel.phases",
// special case in RoomDeviceSettingsHandler
"blacklistUnverifiedDevices",
];
let watchers: WatchManager;
let handler: RoomDeviceSettingsHandler;
let settingListener: CallbackFn;

beforeEach(() => {
watchers = new WatchManager();
handler = new RoomDeviceSettingsHandler(watchers);
settingListener = jest.fn();
});

afterEach(() => {
watchers.unwatchSetting(settingListener);
});

it.each(testSettings)("should write/read/clear the value for »%s«", (setting: string): void => {
// initial value should be null
watchers.watchSetting(setting, roomId, settingListener);

expect(handler.getValue(setting, roomId)).toBeNull();

// set and read value
handler.setValue(setting, roomId, value);
expect(settingListener).toHaveBeenCalledWith(roomId, SettingLevel.ROOM_DEVICE, value);
expect(handler.getValue(setting, roomId)).toEqual(value);

// clear value
handler.setValue(setting, roomId, null);
expect(settingListener).toHaveBeenCalledWith(roomId, SettingLevel.ROOM_DEVICE, null);
expect(handler.getValue(setting, roomId)).toBeNull();
});

it("canSetValue should return true", () => {
expect(handler.canSetValue("test setting", roomId)).toBe(true);
});
});
Loading

0 comments on commit e500964

Please sign in to comment.