Scroll down on <subject> messages.

Also, don't call scrollDown unnecessarily in showStatusMessages
This commit is contained in:
JC Brand 2016-05-27 12:53:07 +00:00
parent 032fe0d417
commit 619d970f25

View File

@ -778,7 +778,9 @@
for (i=0; i<reasons.length; i++) { for (i=0; i<reasons.length; i++) {
this.showStatusNotification(__('The reason given is: "'+reasons[i]+'"'), true); this.showStatusNotification(__('The reason given is: "'+reasons[i]+'"'), true);
} }
if (disconnect_msgs.length || msgs.length || reasons.length) {
this.scrollDown(); this.scrollDown();
}
return el; return el;
}, },
@ -830,6 +832,17 @@
this.occupantsview.updateOccupantsOnPresence(pres); this.occupantsview.updateOccupantsOnPresence(pres);
}, },
setChatRoomSubject: function (sender, subject) {
this.$el.find('.chatroom-topic').text(subject).attr('title', subject);
// For translators: the %1$s and %2$s parts will get replaced by the user and topic text respectively
// Example: Topic set by JC Brand to: Hello World!
this.$content.append(
converse.templates.info({
'message': __('Topic set by %1$s to: %2$s', sender, subject)
}));
this.scrollDown();
},
onChatRoomMessage: function (message) { onChatRoomMessage: function (message) {
var $message = $(message), var $message = $(message),
$forwarded = $message.find('forwarded'), $forwarded = $message.find('forwarded'),
@ -854,13 +867,7 @@
return true; return true;
} }
if (subject) { if (subject) {
this.$el.find('.chatroom-topic').text(subject).attr('title', subject); this.setChatRoomSubject(sender, subject);
// For translators: the %1$s and %2$s parts will get replaced by the user and topic text respectively
// Example: Topic set by JC Brand to: Hello World!
this.$content.append(
converse.templates.info({
'message': __('Topic set by %1$s to: %2$s', sender, subject)
}));
} }
if (sender === '') { if (sender === '') {
return true; return true;