From 9b7f8076ebd782da0a3611c8fc40f9bf6d5597b9 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 28 Sep 2013 16:18:55 -0400 Subject: [PATCH 01/16] removed console.log --- public/src/forum/topic.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 246d25a409..159fb970bc 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -234,7 +234,6 @@ if ($(window).scrollTop() > bottom && !app.infiniteLoaderActive && $('#post-container').children().length) { app.loadMorePosts(tid); - console.log('window scrolling'); } }); } From 4cea3130605fd69c1a9c6bbdfa022c09b6c4fc6e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 28 Sep 2013 17:44:18 -0400 Subject: [PATCH 02/16] updated getPostsByPids method to resolve premature return issue, and refactored it to use async.map instead of eachSeries --- src/posts.js | 63 ++++++++++------------------------------------------ 1 file changed, 12 insertions(+), 51 deletions(-) diff --git a/src/posts.js b/src/posts.js index d3a804acf6..29989fb8e2 100644 --- a/src/posts.js +++ b/src/posts.js @@ -19,7 +19,6 @@ var RDB = require('./redis.js'), Posts.getPostsByTid = function(tid, start, end, callback) { RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) { - RDB.handle(err); if (pids.length) { @@ -154,28 +153,23 @@ var RDB = require('./redis.js'), RDB.hset('post:' + pid, field, value); } - - - - /* getPostsByPids using redis's multi pipeline */ Posts.getPostsByPids = function(pids, callback) { - var posts = [] - var multi = RDB.multi(); + var posts = [], + multi = RDB.multi(); - for (v in pids) { - var _pid = pids[v] - multi.hgetall("post:"+_pid); + for(var x=0,numPids=pids.length;x Date: Sat, 28 Sep 2013 22:05:10 -0400 Subject: [PATCH 03/16] revamped reconnection notification, closes #354 --- public/language/en/footer.json | 3 -- public/src/app.js | 47 +++++++------------------------ public/templates/footer.tpl | 16 ----------- public/templates/header.tpl | 4 +++ public/themes/vanilla/header.less | 16 +++++++++++ 5 files changed, 30 insertions(+), 56 deletions(-) diff --git a/public/language/en/footer.json b/public/language/en/footer.json index 2655ac2795..91cb43fb42 100644 --- a/public/language/en/footer.json +++ b/public/language/en/footer.json @@ -1,7 +1,4 @@ { - "disconnect.title": "Socket Disconnect", - "disconnect.message": "Looks like you disconnected, try reloading the page.", - "disconnect.reload_button": "Reload", "chat.chatting_with": "Chat with ", "chat.placeholder": "type chat message, here press enter to send", "chat.send": "Send", diff --git a/public/src/app.js b/public/src/app.js index c3376caf65..e0acf14152 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -23,8 +23,8 @@ var socket, } else { socket = io.connect(config.socket.address); - var reconnecting = false; - var reconnectTries = 0; + var reconnecting = false, + reconnectEl, reconnectTimer; socket.on('event:connect', function (data) { app.username = data.username; @@ -40,17 +40,12 @@ var socket, socket.on('connect', function (data) { if (reconnecting) { - setTimeout(function () { - app.alert({ - alert_id: 'connection_alert', - title: 'Connected', - message: 'Connection successful.', - type: 'success', - timeout: 5000 - }); - }, 1000); + reconnectEl.html(' Connected!'); reconnecting = false; - reconnectTries = 0; + + setTimeout(function() { + reconnectEl.removeClass('active'); + }, 3000); } socket.emit('api:updateHeader', { @@ -63,33 +58,11 @@ var socket, }); socket.on('reconnecting', function (data) { - function showDisconnectModal() { - $('#disconnect-modal').modal({ - backdrop: 'static', - show: true - }); - - $('#reload-button').on('click', function () { - $('#disconnect-modal').modal('hide'); - window.location.reload(); - }); - } - + if (!reconnectEl) reconnectEl = $('#reconnect'); reconnecting = true; - reconnectTries++; - if (reconnectTries > 4) { - showDisconnectModal(); - return; - } - - app.alert({ - alert_id: 'connection_alert', - title: 'Reconnecting', - message: 'You have disconnected from NodeBB, we will try to reconnect you.
', - type: 'warning', - timeout: 5000 - }); + reconnectEl.addClass('active'); + reconnectEl.html(' Reconnecting...'); }); socket.on('api:user.get_online_users', function (users) { diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index ea47c97d86..38b4614a79 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -2,22 +2,6 @@ - -