Add option to disable grouping in TimelinePanel (#7221)

This commit is contained in:
Germain 2021-11-29 17:01:23 +00:00 committed by GitHub
parent 3f75c6afb0
commit 9d52c23e06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -179,6 +179,7 @@ interface IProps {
getRelationsForEvent?(eventId: string, relationType: string, eventType: string): Relations; getRelationsForEvent?(eventId: string, relationType: string, eventType: string): Relations;
hideThreadedMessages?: boolean; hideThreadedMessages?: boolean;
disableGrouping?: boolean;
} }
interface IState { interface IState {
@ -198,6 +199,10 @@ export default class MessagePanel extends React.Component<IProps, IState> {
static contextType = RoomContext; static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
static defaultProps = {
disableGrouping: false,
};
// opaque readreceipt info for each userId; used by ReadReceiptMarker // opaque readreceipt info for each userId; used by ReadReceiptMarker
// to manage its animations // to manage its animations
private readonly readReceiptMap: Record<string, object> = {}; private readonly readReceiptMap: Record<string, object> = {};
@ -652,7 +657,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
} }
for (const Grouper of groupers) { for (const Grouper of groupers) {
if (Grouper.canStartGroup(this, mxEv)) { if (Grouper.canStartGroup(this, mxEv) && !this.props.disableGrouping) {
grouper = new Grouper( grouper = new Grouper(
this, this,
mxEv, mxEv,

View file

@ -228,6 +228,7 @@ const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) =>
membersLoaded={true} membersLoaded={true}
permalinkCreator={permalinkCreator} permalinkCreator={permalinkCreator}
tileShape={TileShape.ThreadPanel} tileShape={TileShape.ThreadPanel}
disableGrouping={true}
/> />
</BaseCard> </BaseCard>
</RoomContext.Provider> </RoomContext.Provider>

View file

@ -134,6 +134,7 @@ interface IProps {
onPaginationRequest?(timelineWindow: TimelineWindow, direction: string, size: number): Promise<boolean>; onPaginationRequest?(timelineWindow: TimelineWindow, direction: string, size: number): Promise<boolean>;
hideThreadedMessages?: boolean; hideThreadedMessages?: boolean;
disableGrouping?: boolean;
} }
interface IState { interface IState {
@ -223,6 +224,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
className: 'mx_RoomView_messagePanel', className: 'mx_RoomView_messagePanel',
sendReadReceiptOnLoad: true, sendReadReceiptOnLoad: true,
hideThreadedMessages: true, hideThreadedMessages: true,
disableGrouping: false,
}; };
private lastRRSentEventId: string = undefined; private lastRRSentEventId: string = undefined;
@ -1537,6 +1539,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
layout={this.props.layout} layout={this.props.layout}
enableFlair={SettingsStore.getValue(UIFeature.Flair)} enableFlair={SettingsStore.getValue(UIFeature.Flair)}
hideThreadedMessages={this.props.hideThreadedMessages} hideThreadedMessages={this.props.hideThreadedMessages}
disableGrouping={this.props.disableGrouping}
/> />
); );
} }