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

Threading exploration work #6658

Merged
merged 23 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6868478
Add threaded messaging feature flag
germain-gg Jul 8, 2021
cf3117b
Migrate ViewSourceEvent to TypeScript
germain-gg Jul 8, 2021
92394da
Merge branch 'develop' into gsouquet/threaded-messaging-2349
germain-gg Jul 27, 2021
7d4698d
Merge branch 'develop' into gsouquet/threaded-messaging-2349
germain-gg Aug 10, 2021
d971802
Create ThreadView phase in RightPanel
germain-gg Aug 10, 2021
e5024c4
Adapt threading UI to new backend
germain-gg Aug 17, 2021
d1dbfbd
hide thread events from the timeline
germain-gg Aug 17, 2021
458f860
Merge branch 'develop' into gsouquet/threaded-messaging-2349
germain-gg Aug 17, 2021
95f4513
Make UI respond to thread events
germain-gg Aug 17, 2021
ffc7326
Merge branch 'develop' into gsouquet/threaded-messaging-2349
germain-gg Aug 19, 2021
ac0412d
rename feature flag for Threads
germain-gg Aug 19, 2021
d535636
Hide thread UI behind experimentalThreadSupport flag
germain-gg Aug 19, 2021
30a7629
Implement a very low fidelity UI for threads
germain-gg Aug 20, 2021
393bd48
Merge branch 'develop' into gsouquet/threaded-messaging-2349
germain-gg Aug 23, 2021
9facb0d
Polish UI
germain-gg Aug 23, 2021
ef51a46
Fix linting
germain-gg Aug 23, 2021
34da07f
Pass room to ThreadView over roomId
Aug 23, 2021
edd4d42
Merge branch 'develop' into gsouquet/threaded-messaging-2349
Aug 23, 2021
54a0a86
PR feedback
Aug 24, 2021
77a463e
Merge branch 'develop' into gsouquet/threaded-messaging-2349
Aug 25, 2021
bd1aa01
Update copyright and method accessors
Aug 26, 2021
f0a4225
Remove unused renderEventTile method
Aug 26, 2021
bf3c8e5
Fix imports
Aug 27, 2021
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
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
"selector-list-comma-newline-after": null,
"at-rule-no-unknown": null,
"no-descending-specificity": null,
"no-empty-first-line": true,
"scss/at-rule-no-unknown": [true, {
// https://github.com/vector-im/element-web/issues/10544
"ignoreAtRules": ["define-mixin"],
Expand Down
6 changes: 4 additions & 2 deletions res/css/views/rooms/_EventTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ $hover-select-border: 4px;

// Remove some of the default tile padding so that the error is centered
margin-right: 0;

.mx_EventTile_line {
padding-left: 0;
margin-right: 0;
Expand Down Expand Up @@ -675,18 +676,17 @@ $hover-select-border: 4px;
}
}


.mx_ThreadInfo:hover {
cursor: pointer;
}

.mx_ThreadView {

display: flex;
flex-direction: column;

.mx_ScrollPanel {
margin-top: 20px;

.mx_RoomView_MessageList {
padding: 0;
}
Expand All @@ -703,6 +703,7 @@ $hover-select-border: 4px;
max-width: 100%;
display: flex;
align-items: center;

.mx_SenderProfile {
flex: 1;
}
Expand All @@ -722,6 +723,7 @@ $hover-select-border: 4px;
padding-left: 0 !important;
order: 10 !important;
}

.mx_EventTile {
width: 100%;
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions res/css/views/rooms/_MessageComposer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ limitations under the License.

.mx_MessageComposer.mx_MessageComposer--compact {
margin-right: 0;

.mx_MessageComposer_wrapper {
padding: 0;
}

.mx_MessageComposer_button:last-child {
margin-right: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MatrixClientPeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
opts.pendingEventOrdering = PendingEventOrdering.Detached;
opts.lazyLoadMembers = true;
opts.clientWellKnownPollPeriod = 2 * 60 * 60; // 2 hours
opts.experimentalThreadSupport = SettingsStore.getValue("experimentalThreadSupport");
opts.experimentalThreadSupport = SettingsStore.getValue("feature_thread");

// Connect the matrix client to the dispatcher and setting handlers
MatrixActionCreators.start(this.matrixClient);
Expand Down
7 changes: 4 additions & 3 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
componentDidMount() {
this.calculateRoomMembersCount();
this.props.room?.on("RoomState.members", this.calculateRoomMembersCount);
if (SettingsStore.getValue("experimentalThreadSupport")) {
if (SettingsStore.getValue("feature_thread")) {
this.props.room?.getThreads().forEach(thread => thread.fetchReplyChain());
}
this.isMounted = true;
Expand Down Expand Up @@ -448,8 +448,9 @@ export default class MessagePanel extends React.Component<IProps, IState> {
// Always show highlighted event
if (this.props.highlightedEventId === mxEv.getId()) return true;

const threadingEnabled = SettingsStore.getValue("experimentalThreadSupport");
if (threadingEnabled && mxEv.replyEventId && this.props.hideThreadedMessages === true) {
if (mxEv.replyEventId
&& this.props.hideThreadedMessages
&& SettingsStore.getValue("feature_thread")) {
return false;
}

Expand Down
18 changes: 6 additions & 12 deletions src/components/structures/ThreadPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Copyright 2021 New Vector Ltd.
germain-gg marked this conversation as resolved.
Show resolved Hide resolved

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,11 +36,8 @@ interface IState {
threads?: Thread[];
}

/*
* Component which shows the filtered file using a TimelinePanel
*/
@replaceableComponent("structures.ThreadView")
class ThreadView extends React.Component<IProps, IState> {
export default class ThreadPanel extends React.Component<IProps, IState> {
private room: Room;

constructor(props: IProps) {
Expand All @@ -59,15 +55,15 @@ class ThreadView extends React.Component<IProps, IState> {
this.room.removeListener("Thread.ready", this.onThreadEventReceived);
}

public onThreadEventReceived = () => this.updateThreads();
private onThreadEventReceived = () => this.updateThreads();

public updateThreads = (callback?: () => void): void => {
private updateThreads = (callback?: () => void): void => {
this.setState({
threads: this.room.getThreads(),
}, callback);
};

public renderEventTile(event: MatrixEvent): JSX.Element {
private renderEventTile(event: MatrixEvent): JSX.Element {
return <EventTile
key={event.getId()}
mxEvent={event}
Expand All @@ -77,7 +73,7 @@ class ThreadView extends React.Component<IProps, IState> {
/>;
}

public render() {
public render(): JSX.Element {
return (
<BaseCard
className="mx_ThreadPanel"
Expand All @@ -95,5 +91,3 @@ class ThreadView extends React.Component<IProps, IState> {
);
}
}

export default ThreadView;
19 changes: 6 additions & 13 deletions src/components/structures/ThreadView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Copyright 2021 New Vector Ltd.
germain-gg marked this conversation as resolved.
Show resolved Hide resolved

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -22,7 +21,6 @@ import { Thread } from 'matrix-js-sdk/src/models/thread';
import BaseCard from "../views/right_panel/BaseCard";
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import { replaceableComponent } from "../../utils/replaceableComponent";
import { MatrixClientPeg } from '../../MatrixClientPeg';

import ResizeNotifier from '../../utils/ResizeNotifier';
import EventTile, { TileShape } from '../views/rooms/EventTile';
Expand All @@ -48,11 +46,8 @@ interface IState {
thread?: Thread;
}

/*
* Component which shows the filtered file using a TimelinePanel
*/
@replaceableComponent("structures.ThreadView")
class ThreadView extends React.Component<IProps, IState> {
export default class ThreadView extends React.Component<IProps, IState> {
private dispatcherRef: string;

constructor(props: IProps) {
Expand Down Expand Up @@ -93,7 +88,7 @@ class ThreadView extends React.Component<IProps, IState> {
}
};

setupThread = (mxEv: MatrixEvent) => {
private setupThread = (mxEv: MatrixEvent) => {
const thread = mxEv.getThread();
if (thread) {
thread.on("Thread.update", this.updateThread);
Expand All @@ -102,14 +97,14 @@ class ThreadView extends React.Component<IProps, IState> {
}
};

teardownThread = () => {
private teardownThread = () => {
if (this.state.thread) {
this.state.thread.removeListener("Thread.update", this.updateThread);
this.state.thread.removeListener("Thread.ready", this.updateThread);
}
};

updateThread = (thread?: Thread) => {
private updateThread = (thread?: Thread) => {
if (thread) {
this.setState({ thread });
} else {
Expand All @@ -128,7 +123,7 @@ class ThreadView extends React.Component<IProps, IState> {
/>;
}

public render() {
public render(): JSX.Element {
return (
<BaseCard
className="mx_ThreadView"
Expand Down Expand Up @@ -161,5 +156,3 @@ class ThreadView extends React.Component<IProps, IState> {
);
}
}

export default ThreadView;
2 changes: 1 addition & 1 deletion src/components/views/messages/MessageActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default class MessageActionBar extends React.PureComponent {
onClick={this.onReplyClick}
key="reply"
/>
{ SettingsStore.getValue("experimentalThreadSupport") && (
{ SettingsStore.getValue("feature_thread") && (
<RovingAccessibleTooltipButton
className="mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
title={_t("Thread")}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/right_panel/RoomSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
<Button className="mx_RoomSummaryCard_icon_files" onClick={onRoomFilesClick}>
{ _t("Show files") }
</Button>
{ SettingsStore.getValue("experimentalThreadSupport") && (
{ SettingsStore.getValue("feature_thread") && (
<Button className="mx_RoomSummaryCard_icon_threads" onClick={onRoomThreadsClick}>
{ _t("Show threads") }
</Button>
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export default class EventTile extends React.Component<IProps, IState> {
this.isListeningForReceipts = true;
}

if (SettingsStore.getValue("experimentalThreadSupport")) {
if (SettingsStore.getValue("feature_thread")) {
this.props.mxEvent.once("Thread.ready", this.updateThread);
this.props.mxEvent.on("Thread.update", this.updateThread);
}
Expand Down Expand Up @@ -514,7 +514,7 @@ export default class EventTile extends React.Component<IProps, IState> {
}

private renderThreadInfo(): React.ReactNode {
if (!SettingsStore.getValue("experimentalThreadSupport")) {
if (!SettingsStore.getValue("feature_thread")) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_FEATURE,
default: false,
},
"experimentalThreadSupport": {
"feature_thread": {
isFeature: true,
// Requires a reload as we change an option flag on the `js-sdk`
// And the entire sync history needs to be parsed again
Expand Down