Fetch another batch of initial messages if a whole batch was received.

Fixes #1395 where only the first batch was loaded initially.

Signed-off-by: Joachim Bauch <bauch@struktur.de>
This commit is contained in:
Joachim Bauch 2018-12-13 14:38:57 +01:00
Родитель 8bb53047ea
Коммит 709e33e949
Не удалось извлечь подпись
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -74,6 +74,7 @@
this.features = {}; this.features = {};
this.pendingChatRequests = []; this.pendingChatRequests = [];
this._lastChatMessagesFetch = null; this._lastChatMessagesFetch = null;
this.chatBatchSize = 100;
} }
OCA.Talk.Signaling.Base = Base; OCA.Talk.Signaling.Base = Base;
@ -362,6 +363,7 @@
OCA.Talk.Signaling.Base.prototype._getChatRequestData = function(lastKnownMessageId) { OCA.Talk.Signaling.Base.prototype._getChatRequestData = function(lastKnownMessageId) {
return { return {
lastKnownMessageId: lastKnownMessageId, lastKnownMessageId: lastKnownMessageId,
limit: this.chatBatchSize,
lookIntoFuture: 1 lookIntoFuture: 1
}; };
}; };
@ -430,7 +432,9 @@
this._waitTimeUntilRetry = 1; this._waitTimeUntilRetry = 1;
if (this.receiveMessagesAgain) { // Fetch more messages if PHP backend or a whole batch has been received
// (more messages might be available in this case).
if (this.receiveMessagesAgain || (messages && messages.length === this.chatBatchSize)) {
this._receiveChatMessages(); this._receiveChatMessages();
} }