[polari/wip/fmuellner/window-experiments: 1/30] chatView: Make sure we insert something when fetching backlog



commit 579be70021e2198f4204c94c41efa99fef567be0
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 15 23:01:38 2016 +0200

    chatView: Make sure we insert something when fetching backlog
    
    When the user triggers loading of more logs, the expectation is that
    indeed more logs will be inserted in the view. However in order to
    only insert nicks once for consecutive messages from the same user,
    we keep all log events from the same nick as the first one pending
    until we fetch the next batch of log events. As a result we end up
    not inserting anything when all events have the same sender. To
    meet user expectation as well as maintain our grouping, just fetch
    more backlogs immediately in case we didn't insert any logs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768907

 src/chatView.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 29696bb..dabd478 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -470,11 +470,11 @@ const ChatView = new Lang.Class({
 
     _onLogEventsReady: function(lw, res) {
         this._hideLoadingIndicator();
+        this._fetchingBacklog = false;
 
         let [, events] = lw.get_events_finish(res);
         this._pendingLogs = events.concat(this._pendingLogs);
         this._insertPendingLogs();
-        this._fetchingBacklog = false;
     },
 
     _insertPendingLogs: function() {
@@ -495,8 +495,10 @@ const ChatView = new Lang.Class({
             index = 0;
         }
 
-        if (index < 0)
+        if (index < 0) {
+            this._fetchBacklog();
             return;
+        }
 
         let pending = this._pendingLogs.splice(index);
         let state = { lastNick: null, lastTimestamp: 0 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]