Commit a1f68ff4 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents e5c5ea10 f8bcdad8
......@@ -6825,7 +6825,9 @@
}
},
"pluggable.js": {
"version": "git+https://github.com/jcbrand/pluggable.js.git#a281e7207b62c5cc5fad084337fd32c003928e86",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/pluggable.js/-/pluggable.js-2.0.0.tgz",
"integrity": "sha512-FgrSayXWfQQWL+RSDiCAFZbkEsY7hTZCiSuN9Ar/mcHpesxOPfrSzJKp+YbimOt9QFtSd+lR8Uob5tgkdQSOzg==",
"dev": true,
"requires": {
"lodash": "4.17.4"
......
......@@ -58,7 +58,7 @@
"moment": "~2.18.1",
"npm": "^4.1.1",
"otr": "0.2.16",
"pluggable.js": "git+https://github.com/jcbrand/pluggable.js.git",
"pluggable.js": "2.0.0",
"po2json": "^0.4.4",
"requirejs": "2.3.5",
"run-headless-chromium": "^0.1.1",
......
......@@ -419,11 +419,13 @@
}
},
isNotPermanentMessage (el) {
return !_.isNull(el) && (u.hasClass('chat-event', el) || !u.hasClass('message', el));
},
getPreviousMessageElement (el) {
let prev_msg_el = el.previousSibling;
while (!_.isNull(prev_msg_el) &&
!u.hasClass('message', prev_msg_el) &&
!u.hasClass('chat-info', prev_msg_el)) {
while (this.isNotPermanentMessage(prev_msg_el)) {
prev_msg_el = prev_msg_el.previousSibling
}
return prev_msg_el;
......@@ -431,9 +433,7 @@
getLastMessageElement () {
let last_msg_el = this.content.lastElementChild;
while (!_.isNull(last_msg_el) &&
!u.hasClass('message', last_msg_el) &&
!u.hasClass('chat-info', last_msg_el)) {
while (this.isNotPermanentMessage(last_msg_el)) {
last_msg_el = last_msg_el.previousSibling
}
return last_msg_el;
......@@ -441,9 +441,7 @@
getFirstMessageElement () {
let first_msg_el = this.content.firstElementChild;
while (!_.isNull(first_msg_el) &&
!u.hasClass('message', first_msg_el) &&
!u.hasClass('chat-info', first_msg_el)) {
while (this.isNotPermanentMessage(first_msg_el)) {
first_msg_el = first_msg_el.nextSibling
}
return first_msg_el;
......@@ -512,6 +510,7 @@
previous_msg_el.insertAdjacentElement('afterend', message_el);
}
this.insertDayIndicator(message_el);
this.clearStatusNotification();
this.scrollDown();
},
......@@ -556,16 +555,7 @@
template = tpl_message;
username = attrs.sender === 'me' && __('me') || fullname;
}
this.clearStatusNotification();
if (text.length > 8000) {
text = text.substring(0, 10) + '...';
this.showStatusNotification(
__("A very large message has been received. "+
"This might be due to an attack meant to degrade the chat performance. "+
"Output has been shortened."),
true, true);
}
const msg_time = moment(attrs.time) || moment;
const msg = u.stringToElement(template(
_.extend(this.getExtraMessageTemplateAttributes(attrs), {
......
......@@ -78,15 +78,19 @@
(result) => { // Success
if (result.supported) {
const most_recent_msg = utils.getMostRecentMessage(this.model);
const archive_id = most_recent_msg.get('archive_id');
if (archive_id) {
this.fetchArchivedMessages({
'after': most_recent_msg.get('archive_id')
});
if (_.isNil(most_recent_msg)) {
this.fetchArchivedMessages();
} else {
this.fetchArchivedMessages({
'start': most_recent_msg.get('time')
});
const archive_id = most_recent_msg.get('archive_id');
if (archive_id) {
this.fetchArchivedMessages({
'after': most_recent_msg.get('archive_id')
});
} else {
this.fetchArchivedMessages({
'start': most_recent_msg.get('time')
});
}
}
} else {
this.clearSpinner();
......
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