Only insert ELS if it'll be non-empty

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-10-03 09:51:58 +01:00 committed by Bruno Windels
parent 5c960dccb7
commit 6be318b59d

View file

@ -428,7 +428,7 @@ module.exports = createReactClass({
break; break;
} }
// If RM event is in the summary mark it as such and the RM will be appended after the summary. // If RM event is in the summary, mark it as such and the RM will be appended after the summary.
if (collapsedMxEv.getId() === this.props.readMarkerEventId) { if (collapsedMxEv.getId() === this.props.readMarkerEventId) {
readMarkerInSummary = true; readMarkerInSummary = true;
} }
@ -445,22 +445,20 @@ module.exports = createReactClass({
return this._getTilesForEvent(e, e, e === lastShownEvent); return this._getTilesForEvent(e, e, e === lastShownEvent);
}).reduce((a, b) => a.concat(b)); }).reduce((a, b) => a.concat(b));
if (eventTiles.length === 0) { if (eventTiles.length > 0) {
eventTiles = null; ret.push(<EventListSummary
key="roomcreationsummary"
events={summarisedEvents}
onToggle={this._onHeightChanged} // Update scroll state
summaryMembers={[mxEv.sender]}
summaryText={_t("%(creator)s created and configured the room.", {
creator: mxEv.sender ? mxEv.sender.name : mxEv.getSender(),
})}
>
{ eventTiles }
</EventListSummary>);
} }
ret.push(<EventListSummary
key="roomcreationsummary"
events={summarisedEvents}
onToggle={this._onHeightChanged} // Update scroll state
summaryMembers={[mxEv.sender]}
summaryText={_t("%(creator)s created and configured the room.", {
creator: mxEv.sender ? mxEv.sender.name : mxEv.getSender(),
})}
>
{ eventTiles }
</EventListSummary>);
if (readMarkerInSummary) { if (readMarkerInSummary) {
ret.push(this._getReadMarkerTile(visible)); ret.push(this._getReadMarkerTile(visible));
} }