You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-16 22:01:54 +03:00
Merge pull request #1388 from matrix-org/t3chguy/start_mels_expanded
start MELS expanded if it contains a highlighted/permalinked event.
This commit is contained in:
@ -365,8 +365,13 @@ module.exports = React.createClass({
|
|||||||
summarisedEvents.push(collapsedMxEv);
|
summarisedEvents.push(collapsedMxEv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let highlightInMels = false;
|
||||||
|
|
||||||
// At this point, i = the index of the last event in the summary sequence
|
// At this point, i = the index of the last event in the summary sequence
|
||||||
let eventTiles = summarisedEvents.map((e) => {
|
let eventTiles = summarisedEvents.map((e) => {
|
||||||
|
if (e.getId() === this.props.highlightedEventId) {
|
||||||
|
highlightInMels = true;
|
||||||
|
}
|
||||||
// In order to prevent DateSeparators from appearing in the expanded form
|
// In order to prevent DateSeparators from appearing in the expanded form
|
||||||
// of MemberEventListSummary, render each member event as if the previous
|
// of MemberEventListSummary, render each member event as if the previous
|
||||||
// one was itself. This way, the timestamp of the previous event === the
|
// one was itself. This way, the timestamp of the previous event === the
|
||||||
@ -380,15 +385,13 @@ module.exports = React.createClass({
|
|||||||
eventTiles = null;
|
eventTiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.push(
|
ret.push(<MemberEventListSummary key={key}
|
||||||
<MemberEventListSummary
|
events={summarisedEvents}
|
||||||
key={key}
|
onToggle={this._onWidgetLoad} // Update scroll state
|
||||||
events={summarisedEvents}
|
startExpanded={highlightInMels}
|
||||||
onToggle={this._onWidgetLoad} // Update scroll state
|
>
|
||||||
>
|
{eventTiles}
|
||||||
{eventTiles}
|
</MemberEventListSummary>);
|
||||||
</MemberEventListSummary>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (readMarkerInMels) {
|
if (readMarkerInMels) {
|
||||||
ret.push(this._getReadMarkerTile(visible));
|
ret.push(this._getReadMarkerTile(visible));
|
||||||
|
@ -34,11 +34,13 @@ module.exports = React.createClass({
|
|||||||
threshold: React.PropTypes.number,
|
threshold: React.PropTypes.number,
|
||||||
// Called when the MELS expansion is toggled
|
// Called when the MELS expansion is toggled
|
||||||
onToggle: React.PropTypes.func,
|
onToggle: React.PropTypes.func,
|
||||||
|
// Whether or not to begin with state.expanded=true
|
||||||
|
startExpanded: React.PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
expanded: false,
|
expanded: Boolean(this.props.startExpanded),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user