Commit 32b7524492f65efb63890cc0ed97856decf28782

Authored by OpenWapp Developer
1 parent 514272b6bf

Reenabling inbox centine if the buffer continues receiving elements.

Showing 1 changed file with 20 additions and 4 deletions

app/scripts/views/inbox.js View file @ 32b7524
... ... @@ -68,6 +68,14 @@
68 68 return isVisible;
69 69 },
70 70  
  71 + _showCentinel: function () {
  72 + $(this._centinel).show();
  73 + },
  74 +
  75 + _hideCentinel: function () {
  76 + $(this._centinel).hide();
  77 + },
  78 +
71 79 _goToValidate: function () {
72 80 global.router.navigate(
73 81 'validate/' + localStorage.getItem('phoneAndCC'), { trigger: true });
74 82  
... ... @@ -136,14 +144,22 @@
136 144 this.$el.find('#no-conversations').hide();
137 145  
138 146 this._contactListBuffer.appendChild(mc.el);
139   - if (this._checkCentinelVisibility()) {
140   - this._consumeBuffer();
  147 +
  148 + // Display the centinel and process the buffer
  149 + if (this._centinel) {
  150 + this._showCentinel();
  151 + if (this._checkCentinelVisibility()) {
  152 + this._consumeBuffer();
  153 + }
141 154 }
142 155 },
143 156  
144 157 _consumeBuffer: function () {
145 158 var list = this.$el.find('#conversations ul').first();
146 159 list.append(this._contactListBuffer);
  160 + if (global.historyCollection.finishedSyncing) {
  161 + this._hideCentinel();
  162 + }
147 163 },
148 164  
149 165 _onMessagePromoteConversation: function (miniConversation) {
150 166  
... ... @@ -197,11 +213,11 @@
197 213 }
198 214  
199 215 if (this.model.finishedSyncing) {
200   - this.$el.find('#contacts-centinel').hide();
  216 + this._hideCentinel();
201 217 }
202 218 else {
203 219 this.listenToOnce(this.model, 'history:synced', function () {
204   - this.$el.find('#contacts-centinel').hide();
  220 + this._hideCentinel();
205 221 if (this.model.models.length === 0) {
206 222 this.$el.find('#no-conversations').show();
207 223 }