Fixes #1668. MUC MAM blocked by "info" messages
This commit is contained in:
parent
c9830c91b2
commit
5cb5ec4640
@ -395,6 +395,15 @@ converse.plugins.add('converse-chatboxes', {
|
||||
}
|
||||
},
|
||||
|
||||
getMostRecentMessage () {
|
||||
for (var i=this.messages.length-1; i>=0; i--) {
|
||||
const message = this.messages.at(i);
|
||||
if (message.get('type') === this.get('message_type')) {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getUpdatedMessageAttributes (message, stanza) {
|
||||
// Overridden in converse-muc and converse-mam
|
||||
return {};
|
||||
|
@ -73,17 +73,16 @@ converse.plugins.add('converse-mam', {
|
||||
if (this.disable_mam) {
|
||||
return;
|
||||
}
|
||||
const most_recent_msg = u.getMostRecentMessage(this);
|
||||
|
||||
if (!most_recent_msg) {
|
||||
this.fetchArchivedMessages({'before': ''});
|
||||
} else {
|
||||
const most_recent_msg = this.getMostRecentMessage();
|
||||
if (most_recent_msg) {
|
||||
const stanza_id = most_recent_msg.get(`stanza_id ${this.get('jid')}`);
|
||||
if (stanza_id) {
|
||||
this.fetchArchivedMessages({'after': stanza_id}, 'forwards');
|
||||
} else {
|
||||
this.fetchArchivedMessages({'start': most_recent_msg.get('time')}, 'forwards');
|
||||
}
|
||||
} else {
|
||||
this.fetchArchivedMessages({'before': ''});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -98,11 +98,6 @@ u.isSameBareJID = function (jid1, jid2) {
|
||||
Strophe.getBareJidFromJid(jid2).toLowerCase();
|
||||
};
|
||||
|
||||
u.getMostRecentMessage = function (model) {
|
||||
const messages = model.messages.filter('message');
|
||||
return messages[messages.length-1];
|
||||
}
|
||||
|
||||
u.isNewMessage = function (message) {
|
||||
/* Given a stanza, determine whether it's a new
|
||||
* message, i.e. not a MAM archived one.
|
||||
|
Loading…
Reference in New Issue
Block a user