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 @@ ...@@ -8,8 +8,9 @@
- Chat bot messages don't appear when they have the same ids as their commands. - Chat bot messages don't appear when they have the same ids as their commands.
[jcbrand] [jcbrand]
- Updated onDisconnected method to fire disconnected event even if `auto_reconnect = false`. [kamranzafar] - 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 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) ## 1.0.2 (2016-05-24)
......
...@@ -335,7 +335,10 @@ ...@@ -335,7 +335,10 @@
if (converse.windowState === 'blur' || this.model.get('scrolled', true)) { if (converse.windowState === 'blur' || this.model.get('scrolled', true)) {
converse.incrementMsgCounter(); 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'); this.$el.find('.new-msgs-indicator').removeClass('hidden');
} }
} else { } else {
......
...@@ -1167,7 +1167,7 @@ ...@@ -1167,7 +1167,7 @@
}); });
}, },
createMessage: function ($message, $delay, original_stanza) { getMessageAttributes: function ($message, $delay, original_stanza) {
$delay = $delay || $message.find('delay'); $delay = $delay || $message.find('delay');
var body = $message.children('body').text(), var body = $message.children('body').text(),
delayed = $delay.length > 0, delayed = $delay.length > 0,
...@@ -1199,7 +1199,7 @@ ...@@ -1199,7 +1199,7 @@
} else { } else {
sender = 'them'; sender = 'them';
} }
return this.messages.create({ return {
chat_state: chat_state, chat_state: chat_state,
delayed: delayed, delayed: delayed,
fullname: fullname, fullname: fullname,
...@@ -1207,7 +1207,11 @@ ...@@ -1207,7 +1207,11 @@
msgid: $message.attr('id'), msgid: $message.attr('id'),
sender: sender, sender: sender,
time: time time: time
}); };
},
createMessage: function ($message, $delay, original_stanza) {
return this.messages.create(this.getMessageAttributes.apply(this, arguments));
} }
}); });
......
...@@ -49,12 +49,10 @@ ...@@ -49,12 +49,10 @@
}, },
ChatBox: { ChatBox: {
createMessage: function ($message, $delay, original_stanza) { getMessageAttributes: function ($message, $delay, original_stanza) {
var message = this._super.createMessage.apply(this, arguments); var attrs = this._super.getMessageAttributes.apply(this, arguments);
message.save({ attrs.archive_id = $(original_stanza).find('result[xmlns="'+Strophe.NS.MAM+'"]').attr('id');
archive_id: $(original_stanza).find('result[xmlns="'+Strophe.NS.MAM+'"]').attr('id') return attrs;
});
return message;
} }
}, },
......
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