Commit 31cfde51be5f0c54ea12d89481136f3304d9fb24
1 parent
0ece79b509
Fix the queue for fetching group pictures. Inbox working smooth!
Showing 1 changed file with 9 additions and 6 deletions
app/scripts/collections/history.js
View file @
31cfde5
... | ... | @@ -289,24 +289,27 @@ |
289 | 289 | }); |
290 | 290 | }, |
291 | 291 | |
292 | + _pictureQueue: [], | |
293 | + | |
292 | 294 | _fetchPicture: function (conversation) { |
293 | 295 | var _this = this; |
294 | 296 | |
295 | - function _realFetch() { | |
296 | - var task; | |
297 | + function _nextFetch() { | |
297 | 298 | if (_this._pictureQueue.length > 0) { |
298 | - task = _this._pictureQueue.shift(); | |
299 | - task(_realFetch); | |
299 | + var task = _this._pictureQueue[0]; | |
300 | + task(function _onFinished() { | |
301 | + _this._pictureQueue.shift(); | |
302 | + _nextFetch(); | |
303 | + }); | |
300 | 304 | } |
301 | 305 | } |
302 | 306 | |
303 | - this._pictureQueue = this._pictureQueue || []; | |
304 | 307 | this._pictureQueue.push(function fetchTask(next) { |
305 | 308 | conversation.get('contact').updatePhoto(next); |
306 | 309 | }); |
307 | 310 | |
308 | 311 | if (this._pictureQueue.length === 1) { |
309 | - _realFetch(); | |
312 | + _nextFetch(); | |
310 | 313 | } |
311 | 314 | |
312 | 315 | }, |