This commit is contained in:
JC Brand 2019-09-06 16:14:30 +02:00
parent cc91f3751e
commit 46ccc1a87f
2 changed files with 16 additions and 12 deletions

View File

@ -12,6 +12,8 @@
different path, you'll need to set `publicPath` in `webpack.config.js` to
your preferred path and then rebuild all assets (e.g. `make dist`).
- Use `listenTo` to avoid memory leaks when views get removed.
- #1692 Bugfix: `TypeError: oldest_message is undefined`
## 5.0.1 (2019-08-14)

View File

@ -37,19 +37,21 @@ converse.plugins.add('converse-mam-views', {
const { _converse } = this.__super__;
if (this.content.scrollTop === 0 && this.model.messages.length) {
const oldest_message = this.model.getOldestMessage();
const by_jid = this.model.get('jid');
const stanza_id = oldest_message && oldest_message.get(`stanza_id ${by_jid}`);
this.addSpinner();
if (stanza_id) {
await this.model.fetchArchivedMessages({
'before': stanza_id
});
} else {
await this.model.fetchArchivedMessages({
'end': oldest_message.get('time')
});
if (oldest_message) {
const by_jid = this.model.get('jid');
const stanza_id = oldest_message && oldest_message.get(`stanza_id ${by_jid}`);
this.addSpinner();
if (stanza_id) {
await this.model.fetchArchivedMessages({
'before': stanza_id
});
} else {
await this.model.fetchArchivedMessages({
'end': oldest_message.get('time')
});
}
this.clearSpinner();
}
this.clearSpinner();
}
}
},