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

Use cached value to read member count #6429

Merged
merged 3 commits into from
Jul 21, 2021
Merged
Changes from 1 commit
Commits
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
4 changes: 3 additions & 1 deletion src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ export default class MessagePanel extends React.Component<IProps, IState> {

const callEventGrouper = this.callEventGroupers.get(mxEv.getContent().call_id);

const isDirectMessage = this.props.room?.getJoinedMemberCount() <= 2;

// use txnId as key if available so that we don't remount during sending
ret.push(
<TileErrorBoundary key={mxEv.getTxnId() || eventId} mxEvent={mxEv}>
Expand Down Expand Up @@ -743,7 +745,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
enableFlair={this.props.enableFlair}
showReadReceipts={this.props.showReadReceipts}
callEventGrouper={callEventGrouper}
hideSender={this.props.room?.getMembers().length <= 2 && this.props.layout === Layout.Bubble}
hideSender={isDirectMessage && this.props.layout === Layout.Bubble}
/>
</TileErrorBoundary>,
);
Expand Down