Commit 2b88db81 authored by JC Brand's avatar JC Brand

Don't show "new messages" indicator for archived messages

parent a050015e
......@@ -8,8 +8,9 @@
- Chat bot messages don't appear when they have the same ids as their commands.
[jcbrand]
- Updated onDisconnected method to fire disconnected event even if `auto_reconnect = false`. [kamranzafar]
- Bugfix: MAM messages weren't being fetched oldest first. [jcbrand]
- #553 Add processing hints to OTR messages [jcbrand]
- #553 Add processing hints to chat state notifications [jcbrand]
- Add processing hints to chat state notifications [jcbrand]
## 1.0.2 (2016-05-24)
......
......@@ -335,7 +335,10 @@
if (converse.windowState === 'blur' || this.model.get('scrolled', true)) {
converse.incrementMsgCounter();
}
if (this.model.get('scrolled', true)) {
if (!message.get('archive_id') && this.model.get('scrolled', true)) {
// Show "new messages" indicator if we're scrolled
// up, but only if the new message is not a MAM
// archived one.
this.$el.find('.new-msgs-indicator').removeClass('hidden');
}
} else {
......
......@@ -1167,7 +1167,7 @@
});
},
createMessage: function ($message, $delay, original_stanza) {
getMessageAttributes: function ($message, $delay, original_stanza) {
$delay = $delay || $message.find('delay');
var body = $message.children('body').text(),
delayed = $delay.length > 0,
......@@ -1199,7 +1199,7 @@
} else {
sender = 'them';
}
return this.messages.create({
return {
chat_state: chat_state,
delayed: delayed,
fullname: fullname,
......@@ -1207,7 +1207,11 @@
msgid: $message.attr('id'),
sender: sender,
time: time
});
};
},
createMessage: function ($message, $delay, original_stanza) {
return this.messages.create(this.getMessageAttributes.apply(this, arguments));
}
});
......
......@@ -49,12 +49,10 @@
},
ChatBox: {
createMessage: function ($message, $delay, original_stanza) {
var message = this._super.createMessage.apply(this, arguments);
message.save({
archive_id: $(original_stanza).find('result[xmlns="'+Strophe.NS.MAM+'"]').attr('id')
});
return message;
getMessageAttributes: function ($message, $delay, original_stanza) {
var attrs = this._super.getMessageAttributes.apply(this, arguments);
attrs.archive_id = $(original_stanza).find('result[xmlns="'+Strophe.NS.MAM+'"]').attr('id');
return attrs;
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment