From 11718a982a71683ee393827a394d261d62da3b77 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 9 Jul 2019 17:53:35 +0200 Subject: [PATCH] use originalEvent if present and append it to list --- src/components/views/dialogs/MessageEditHistoryDialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/views/dialogs/MessageEditHistoryDialog.js b/src/components/views/dialogs/MessageEditHistoryDialog.js index 53dd6b2a1b..9ba570292f 100644 --- a/src/components/views/dialogs/MessageEditHistoryDialog.js +++ b/src/components/views/dialogs/MessageEditHistoryDialog.js @@ -30,6 +30,7 @@ export default class MessageEditHistoryDialog extends React.PureComponent { constructor(props) { super(props); this.state = { + originalEvent: null, error: null, events: [], nextBatch: null, @@ -66,6 +67,7 @@ export default class MessageEditHistoryDialog extends React.PureComponent { const newEvents = result.events; this._locallyRedactEventsIfNeeded(newEvents); this.setState({ + originalEvent: this.state.originalEvent || result.originalEvent, events: this.state.events.concat(newEvents), nextBatch: result.nextBatch, isLoading: false, @@ -100,7 +102,12 @@ export default class MessageEditHistoryDialog extends React.PureComponent { const DateSeparator = sdk.getComponent('messages.DateSeparator'); const nodes = []; let lastEvent; - this.state.events.forEach(e => { + let allEvents = this.state.events; + // append original event when we've done last pagination + if (this.state.originalEvent && !this.state.nextBatch) { + allEvents = allEvents.concat(this.state.originalEvent); + } + allEvents.forEach(e => { if (!lastEvent || wantsDateSeparator(lastEvent.getDate(), e.getDate())) { nodes.push(
  • ); }