From ffafb84530248aa4b4073b00430998fa67b953ed Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Mon, 29 Nov 2021 15:37:38 +0000 Subject: [PATCH] Add option to disable grouping in TimelinePanel --- src/components/structures/MessagePanel.tsx | 7 ++++++- src/components/structures/ThreadPanel.tsx | 1 + src/components/structures/TimelinePanel.tsx | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index bb0ee29bb07..60a0829e2de 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -179,6 +179,7 @@ interface IProps { getRelationsForEvent?(eventId: string, relationType: string, eventType: string): Relations; hideThreadedMessages?: boolean; + disableGrouping?: boolean; } interface IState { @@ -198,6 +199,10 @@ export default class MessagePanel extends React.Component { static contextType = RoomContext; public context!: React.ContextType; + static defaultProps = { + disableGrouping: false, + }; + // opaque readreceipt info for each userId; used by ReadReceiptMarker // to manage its animations private readonly readReceiptMap: Record = {}; @@ -652,7 +657,7 @@ export default class MessagePanel extends React.Component { } for (const Grouper of groupers) { - if (Grouper.canStartGroup(this, mxEv)) { + if (Grouper.canStartGroup(this, mxEv) && !this.props.disableGrouping) { grouper = new Grouper( this, mxEv, diff --git a/src/components/structures/ThreadPanel.tsx b/src/components/structures/ThreadPanel.tsx index 04c69827fb6..3e1e658af20 100644 --- a/src/components/structures/ThreadPanel.tsx +++ b/src/components/structures/ThreadPanel.tsx @@ -228,6 +228,7 @@ const ThreadPanel: React.FC = ({ roomId, onClose, permalinkCreator }) => membersLoaded={true} permalinkCreator={permalinkCreator} tileShape={TileShape.ThreadPanel} + disableGrouping={true} /> diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index 71d0775e41c..f8cc46153fd 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -134,6 +134,7 @@ interface IProps { onPaginationRequest?(timelineWindow: TimelineWindow, direction: string, size: number): Promise; hideThreadedMessages?: boolean; + disableGrouping?: boolean; } interface IState { @@ -223,6 +224,7 @@ class TimelinePanel extends React.Component { className: 'mx_RoomView_messagePanel', sendReadReceiptOnLoad: true, hideThreadedMessages: true, + disableGrouping: false, }; private lastRRSentEventId: string = undefined; @@ -1540,6 +1542,7 @@ class TimelinePanel extends React.Component { layout={this.props.layout} enableFlair={SettingsStore.getValue(UIFeature.Flair)} hideThreadedMessages={this.props.hideThreadedMessages} + disableGrouping={this.props.disableGrouping} /> ); }