Fixes #1692
This commit is contained in:
parent
cc91f3751e
commit
46ccc1a87f
|
@ -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)
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user