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

Commit 9d52c23

Browse files
authored
Add option to disable grouping in TimelinePanel (#7221)
1 parent 3f75c6a commit 9d52c23

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/components/structures/MessagePanel.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ interface IProps {
179179
getRelationsForEvent?(eventId: string, relationType: string, eventType: string): Relations;
180180

181181
hideThreadedMessages?: boolean;
182+
disableGrouping?: boolean;
182183
}
183184

184185
interface IState {
@@ -198,6 +199,10 @@ export default class MessagePanel extends React.Component<IProps, IState> {
198199
static contextType = RoomContext;
199200
public context!: React.ContextType<typeof RoomContext>;
200201

202+
static defaultProps = {
203+
disableGrouping: false,
204+
};
205+
201206
// opaque readreceipt info for each userId; used by ReadReceiptMarker
202207
// to manage its animations
203208
private readonly readReceiptMap: Record<string, object> = {};
@@ -652,7 +657,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
652657
}
653658

654659
for (const Grouper of groupers) {
655-
if (Grouper.canStartGroup(this, mxEv)) {
660+
if (Grouper.canStartGroup(this, mxEv) && !this.props.disableGrouping) {
656661
grouper = new Grouper(
657662
this,
658663
mxEv,

src/components/structures/ThreadPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) =>
228228
membersLoaded={true}
229229
permalinkCreator={permalinkCreator}
230230
tileShape={TileShape.ThreadPanel}
231+
disableGrouping={true}
231232
/>
232233
</BaseCard>
233234
</RoomContext.Provider>

src/components/structures/TimelinePanel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ interface IProps {
134134
onPaginationRequest?(timelineWindow: TimelineWindow, direction: string, size: number): Promise<boolean>;
135135

136136
hideThreadedMessages?: boolean;
137+
disableGrouping?: boolean;
137138
}
138139

139140
interface IState {
@@ -223,6 +224,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
223224
className: 'mx_RoomView_messagePanel',
224225
sendReadReceiptOnLoad: true,
225226
hideThreadedMessages: true,
227+
disableGrouping: false,
226228
};
227229

228230
private lastRRSentEventId: string = undefined;
@@ -1537,6 +1539,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
15371539
layout={this.props.layout}
15381540
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
15391541
hideThreadedMessages={this.props.hideThreadedMessages}
1542+
disableGrouping={this.props.disableGrouping}
15401543
/>
15411544
);
15421545
}

0 commit comments

Comments
 (0)