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;
}
// 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) {
readMarkerInSummary = true;
}
@ -445,22 +445,20 @@ module.exports = createReactClass({
return this._getTilesForEvent(e, e, e === lastShownEvent);
}).reduce((a, b) => a.concat(b));
if (eventTiles.length === 0) {
eventTiles = null;
if (eventTiles.length > 0) {
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) {
ret.push(this._getReadMarkerTile(visible));
}