From f4d23fe5df12a9be5d83b505df51d38adaba0a83 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Fri, 21 Feb 2014 23:47:55 -0500 Subject: [PATCH 01/30] return version in config --- src/routes/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/api.js b/src/routes/api.js index 57336503df..a89b61ed5b 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -44,6 +44,7 @@ var path = require('path'), app.get('/config', function (req, res, next) { var config = require('../../public/config.json'); + config.version = pkg.version; config.postDelay = meta.config.postDelay; config.minimumTitleLength = meta.config.minimumTitleLength; config.maximumTitleLength = meta.config.maximumTitleLength; From bae76ebd704514e07b0716a113ac4888e28e1c4b Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 00:49:32 -0500 Subject: [PATCH 02/30] fixed the redis error when going to unread/recent if nextStart is missing --- public/src/forum/unread.js | 1 + src/routes/api.js | 6 ++++++ src/topics.js | 28 ++++++++++------------------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index 3ed2baf5cc..9829ca7a25 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -47,6 +47,7 @@ define(['forum/recent'], function(recent) { if(!$('#topics-container').length) { return; } + loadingMoreTopics = true; socket.emit('topics.loadMoreUnreadTopics', { after: $('#topics-container').attr('data-nextstart') diff --git a/src/routes/api.js b/src/routes/api.js index a89b61ed5b..7cdd7a8589 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -287,6 +287,9 @@ var path = require('path'), app.get('/unread', function (req, res, next) { var uid = (req.user) ? req.user.uid : 0; + if(!req.user) { + return res.json(403, 'not-allowed'); + } topics.getUnreadTopics(uid, 0, 19, function (err, data) { if(err) { return next(err); @@ -298,6 +301,9 @@ var path = require('path'), app.get('/unread/total', function (req, res, next) { var uid = (req.user) ? req.user.uid : 0; + if(!req.user) { + return res.json(403, 'not-allowed'); + } topics.getTotalUnread(uid, function (err, data) { if(err) { return next(err); diff --git a/src/topics.js b/src/topics.js index 2de59a0062..7e0362e2cd 100644 --- a/src/topics.js +++ b/src/topics.js @@ -445,7 +445,8 @@ var async = require('async'), function getTopics(set, uid, tids, callback) { var returnTopics = { - 'topics': [] + topics: [], + nextStart: 0 }; if (!tids || !tids.length) { @@ -571,18 +572,14 @@ var async = require('async'), }; Topics.getUnreadTopics = function(uid, start, stop, callback) { + var unreadTopics = { - 'show_markallread_button': 'show', - 'no_topics_message': 'hidden', - 'topics': [] + no_topics_message: '', + show_markallread_button: 'hidden', + nextStart : 0, + topics: [] }; - function noUnreadTopics() { - unreadTopics.no_topics_message = ''; - unreadTopics.show_markallread_button = 'hidden'; - callback(null, unreadTopics); - } - function sendUnreadTopics(topicIds) { Topics.getTopicsByTids(topicIds, 0, uid, function(err, topicData) { @@ -597,13 +594,8 @@ var async = require('async'), unreadTopics.topics = topicData; unreadTopics.nextStart = parseInt(rank, 10) + 1; - - if (!topicData || topicData.length === 0) { - unreadTopics.no_topics_message = ''; - } - if (uid === 0 || topicData.length === 0) { - unreadTopics.show_markallread_button = 'hidden'; - } + unreadTopics.no_topics_message = (!topicData || topicData.length === 0) ? '' : 'hidden'; + unreadTopics.show_markallread_button = topicData.length === 0 ? 'hidden' : ''; callback(null, unreadTopics); }); @@ -618,7 +610,7 @@ var async = require('async'), if (unreadTids.length) { sendUnreadTopics(unreadTids); } else { - noUnreadTopics(); + callback(null, unreadTopics); } }); }; From cfe5b6aa4a1c3e845e793a7dccdd9852fa57c0aa Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 02:01:08 -0500 Subject: [PATCH 03/30] check if thumEl exists before trim --- public/src/modules/composer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 1ae70fee16..3e352401a4 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -711,7 +711,9 @@ define(['taskbar'], function(taskbar) { titleEl.val(titleEl.val().trim()); bodyEl.val(bodyEl.val().trim()); - thumbEl.val(thumbEl.val().trim()); + if(thumbEl.length) { + thumbEl.val(thumbEl.val().trim()); + } var checkTitle = parseInt(postData.cid, 10) || parseInt(postData.pid, 10); @@ -729,7 +731,7 @@ define(['taskbar'], function(taskbar) { socket.emit('topics.post', { title: titleEl.val(), content: bodyEl.val(), - topic_thumb: thumbEl.val(), + topic_thumb: thumbEl.val() || '', category_id: postData.cid }, done); } else if (parseInt(postData.tid, 10) > 0) { @@ -742,7 +744,7 @@ define(['taskbar'], function(taskbar) { pid: postData.pid, content: bodyEl.val(), title: titleEl.val(), - topic_thumb: thumbEl.val() + topic_thumb: thumbEl.val() || '' }, done); } From f57e293abb4f2c64ebd1e9ccc21ca2899dacc9c6 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 02:35:33 -0500 Subject: [PATCH 04/30] plugin buttons indicate active state --- public/templates/admin/plugins.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/admin/plugins.tpl b/public/templates/admin/plugins.tpl index 5a9d62d0fa..b001f3594b 100644 --- a/public/templates/admin/plugins.tpl +++ b/public/templates/admin/plugins.tpl @@ -5,7 +5,7 @@
  • {plugins.name}

    - +

    {plugins.description}

    For more information: {plugins.url}

    From 3f43ca09257dd10179ce8f2a3cae74e4dd6bf5fa Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 02:40:28 -0500 Subject: [PATCH 05/30] change on click --- public/src/forum/admin/plugins.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/forum/admin/plugins.js b/public/src/forum/admin/plugins.js index 6f197e8bb0..9386f8390f 100644 --- a/public/src/forum/admin/plugins.js +++ b/public/src/forum/admin/plugins.js @@ -12,8 +12,9 @@ define(function() { }); socket.on('admin.plugins.toggle', function(status) { - pluginTgl = document.querySelector('.plugins li[data-plugin-id="' + status.id + '"] button'); - pluginTgl.innerHTML = ' ' + (status.active ? 'Dea' : 'A') + 'ctivate'; + pluginTgl = $('.plugins li[data-plugin-id="' + status.id + '"] button'); + pluginTgl.html(' ' + (status.active ? 'Dea' : 'A') + 'ctivate'); + pluginTgl.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active); app.alert({ alert_id: 'plugin_toggled_' + status.id, From a8c7b32a04619a80a4d2e3b25ce33b20bccb99d7 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 02:44:30 -0500 Subject: [PATCH 06/30] moved plugin alert to top --- public/templates/admin/plugins.tpl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/templates/admin/plugins.tpl b/public/templates/admin/plugins.tpl index b001f3594b..3aa7e5f5e1 100644 --- a/public/templates/admin/plugins.tpl +++ b/public/templates/admin/plugins.tpl @@ -1,5 +1,14 @@

    Plugins

    +
    +

    + Interested in writing plugins for NodeBB? +

    +

    + Full documentation regarding plugin authoring can be found in the NodeBB Wiki. +

    +
    +
    • @@ -13,11 +22,4 @@
    -
    -

    - Interested in writing plugins for NodeBB? -

    -

    - Full documentation regarding plugin authoring can be found in the NodeBB Wiki. -

    -
    + From ca4b9346f35951f6a5abc66aa78d3e5d88f1af46 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 22 Feb 2014 11:08:02 -0500 Subject: [PATCH 07/30] resolved #1039 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2dd6ff5718..26fa21c5f3 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "express-namespace": "~0.1.1", "emailjs": "0.3.4", "cookie": "0.0.6", - "passport": "0.1.17", + "passport": "^0.2.0", "passport-local": "0.1.6", "passport-twitter": "0.1.5", "passport-google-oauth": "0.1.5", From 6bc6c88e896c498ba4488c2ee46cb3f601707447 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 22 Feb 2014 11:18:16 -0500 Subject: [PATCH 08/30] pruning dependencies, and removed contributors from package.json -- full list can be found at https://github.com/designcreateplay/NodeBB/graphs/contributors --- package.json | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 26fa21c5f3..11c97be818 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,8 @@ "socket.io": "~0.9.16", "express": "3.2.0", "express-namespace": "~0.1.1", - "emailjs": "0.3.4", - "cookie": "0.0.6", "passport": "^0.2.0", "passport-local": "0.1.6", - "passport-twitter": "0.1.5", - "passport-google-oauth": "0.1.5", - "passport-facebook": "0.1.5", "less-middleware": "0.1.12", "marked": "0.2.8", "async": "~0.2.8", @@ -30,35 +25,31 @@ "gravatar": "1.0.6", "nconf": "~0.6.7", "sitemap": "~0.7.1", - "request": "~2.25.0", "reds": "~0.2.4", "winston": "~0.7.2", "rss": "~0.2.0", "prompt": "~0.2.11", "uglify-js": "~2.4.0", "validator": "~3.2.1", - "nodebb-plugin-mentions": "~0.4", - "nodebb-plugin-markdown": "~0.3", - "nodebb-widget-essentials": "~0.0", - "nodebb-theme-vanilla": "~0.0.14", - "nodebb-theme-cerulean": "~0.0.13", - "nodebb-theme-lavender": "~0.0.21", "cron": "~1.0.1", "semver": "~2.2.1", "string": "~1.7.0", "xregexp": "~2.0.0", "socket.io-wildcard": "~0.1.1", - "bcryptjs": "~0.7.10" + "bcryptjs": "~0.7.10", + "nodebb-plugin-mentions": "~0.4", + "nodebb-plugin-markdown": "~0.3", + "nodebb-widget-essentials": "~0.0", + "nodebb-theme-vanilla": "~0.0.14", + "nodebb-theme-cerulean": "~0.0.13", + "nodebb-theme-lavender": "~0.0.21" }, "optionalDependencies": { "redis": "0.8.3", - "mongodb": "~1.3.19", - "connect-redis": "1.4.5", - "connect-mongo": "0.4.0", "hiredis": "~0.1.15", - "nodebb-plugin-sso-facebook": "~0.1.0", - "nodebb-plugin-sso-twitter": "~0.1.0", - "nodebb-plugin-sso-google": "~0.1.0" + "connect-redis": "1.4.5", + "mongodb": "~1.3.19", + "connect-mongo": "0.4.0" }, "devDependencies": { "mocha": "~1.13.0" @@ -69,7 +60,7 @@ "engines": { "node": ">=0.8" }, - "contributors": [ + "maintainers": [ { "name": "Andrew Rodrigues", "email": "andrew@designcreateplay.com", @@ -84,22 +75,6 @@ "name": "Barış Soner Uşaklı", "email": "baris@designcreateplay.com", "url": "https://github.com/barisusakli" - }, - { - "name": "Andrew Darqui", - "url": "https://github.com/adarqui" - }, - { - "name": "Damian Bushong", - "url": "https://github.com/damianb" - }, - { - "name": "Matt Smith", - "url": "https://github.com/soimafreak" - }, - { - "name": "Quinton Marchi", - "url": "https://github.com/iamcardinal" } ] } From d4084b15861b54ba574d5313a9b117f1a36176d6 Mon Sep 17 00:00:00 2001 From: Luciano Miranda Date: Sat, 22 Feb 2014 16:52:13 -0300 Subject: [PATCH 09/30] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 11c97be818..f35c875dc3 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "socket.io": "~0.9.16", "express": "3.2.0", "express-namespace": "~0.1.1", - "passport": "^0.2.0", + "passport": "~0.2.0", "passport-local": "0.1.6", "less-middleware": "0.1.12", "marked": "0.2.8", From 60905b2e218b680ec9d34f9567288b27b38e622b Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 16:48:58 -0500 Subject: [PATCH 10/30] getPidPage fix, pids are strings --- src/posts.js | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/posts.js b/src/posts.js index 441b638e82..b010ef19b5 100644 --- a/src/posts.js +++ b/src/posts.js @@ -474,31 +474,31 @@ var db = require('./database'), } Posts.getPidPage = function(pid, uid, callback) { - Posts.getPostField(pid, 'tid', function(err, tid) { - if(err) { - return callback(err); - } - - topics.getPids(tid, function(err, pids) { - if(err) { - return callback(err); - } - - var index = pids.indexOf(pid); + if(!pid) { + return callback(new Error('invalid-pid')); + } + var index = 0; + async.waterfall([ + function(next) { + Posts.getPostField(pid, 'tid', next); + }, + function(tid, next) { + topics.getPids(tid, next); + }, + function(pids, next) { + index = pids.indexOf(pid.toString()); if(index === -1) { - return callback(new Error('pid not found')); + return next(new Error('pid not found')); } - - user.getSettings(uid, function(err, settings) { - if(err) { - return callback(err); - } - - var page = Math.ceil((index + 1) / settings.postsPerPage); - callback(null, page); - }); - }); - }); + next(); + }, + function(next) { + user.getSettings(uid, next); + }, + function(settings, next) { + next(null, Math.ceil((index + 1) / settings.postsPerPage)); + } + ], callback); }; Posts.getPidIndex = function(pid, callback) { From d6d9776cde44cd9851f2c2973ea800cf23764b94 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 17:56:13 -0500 Subject: [PATCH 11/30] added toPid to posts --- public/src/forum/topic.js | 7 ++++--- public/src/modules/composer.js | 13 +++++++------ src/posts.js | 11 ++++++++++- src/socket.io/posts.js | 5 ++++- src/topics.js | 14 +++++++++----- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index dbb1aa3431..e9fa69e934 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -405,13 +405,14 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } var username = '', - post = $(this).parents('li[data-pid]'); + post = $(this).parents('li[data-pid]'), + pid = $(this).parents('.post-row').attr('data-pid'); if (post.length) { username = '@' + post.attr('data-username').replace(/\s/g, '-') + ' '; } if (thread_state.locked !== '1') { - composer.newReply(tid, topic_name, selectionText.length > 0 ? selectionText + '\n\n' + username : '' + username); + composer.newReply(tid, pid, topic_name, selectionText.length > 0 ? selectionText + '\n\n' + username : '' + username); } }); @@ -436,7 +437,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { if($('.composer').length) { composer.addQuote(tid, pid, topic_name, username, quoted); }else { - composer.newReply(tid, topic_name, username + ' said:\n' + quoted); + composer.newReply(tid, pid, topic_name, username + ' said:\n' + quoted); } }); } diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 3e352401a4..9c1bbf351c 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -294,22 +294,22 @@ define(['taskbar'], function(taskbar) { var prevText = bodyEl.val(); if(tid !== composer.posts[uuid].tid) { text = username + ' said in ['+title+'](/topic/'+tid+'#'+pid+'):\n'+text; - }else { + } else { text = username + ' said:\n' + text; } composer.posts[uuid].body = (prevText.length ? prevText + '\n\n' : '') + text; bodyEl.val(composer.posts[uuid].body); - }else{ - composer.newReply(tid,title,username + ' said:\n' + text); + } else { + composer.newReply(tid, pid, title, username + ' said:\n' + text); } - } }; - composer.newReply = function(tid, title, text) { + composer.newReply = function(tid, pid, title, text) { if(allowed()) { push({ tid: tid, + toPid: pid, title: title, body: text, modified: false, @@ -737,7 +737,8 @@ define(['taskbar'], function(taskbar) { } else if (parseInt(postData.tid, 10) > 0) { socket.emit('posts.reply', { topic_id: postData.tid, - content: bodyEl.val() + content: bodyEl.val(), + toPid: postData.toPid }, done); } else if (parseInt(postData.pid, 10) > 0) { socket.emit('posts.edit', { diff --git a/src/posts.js b/src/posts.js index b010ef19b5..fa3703a585 100644 --- a/src/posts.js +++ b/src/posts.js @@ -20,7 +20,12 @@ var db = require('./database'), (function(Posts) { var customUserInfo = {}; - Posts.create = function(uid, tid, content, callback) { + Posts.create = function(data, callback) { + var uid = data.uid, + tid = data.tid, + content = data.content, + toPid = data.toPid; + if (uid === null) { return callback(new Error('invalid-user'), null); } @@ -56,6 +61,10 @@ var db = require('./database'), 'deleted': 0 }; + if (toPid) { + postData['toPid'] = toPid; + } + db.setObject('post:' + pid, postData, function(err) { if(err) { return next(err); diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 2d10ec91b1..2b54551554 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -14,6 +14,7 @@ var async = require('async'), SocketPosts = {}; SocketPosts.reply = function(socket, data, callback) { + if (!socket.uid && !parseInt(meta.config.allowGuestPosting, 10)) { socket.emit('event:alert', { title: 'Reply Unsuccessful', @@ -28,7 +29,9 @@ SocketPosts.reply = function(socket, data, callback) { return callback(new Error('invalid data')); } - topics.reply(data.topic_id, socket.uid, data.content, function(err, postData) { + data.uid = socket.uid; + + topics.reply(data, function(err, postData) { if(err) { if (err.message === 'content-too-short') { module.parent.exports.emitContentTooShortAlert(socket); diff --git a/src/topics.js b/src/topics.js index 7e0362e2cd..b7e22871a5 100644 --- a/src/topics.js +++ b/src/topics.js @@ -121,7 +121,7 @@ var async = require('async'), Topics.create({uid: uid, title: title, cid: cid, thumb: thumb}, next); }, function(tid, next) { - Topics.reply(tid, uid, content, next); + Topics.reply({uid:uid, tid:tid, content:content}, next); }, function(postData, next) { threadTools.toggleFollow(postData.tid, uid); @@ -143,9 +143,13 @@ var async = require('async'), ], callback); }; - Topics.reply = function(tid, uid, content, callback) { - var privileges; - var postData; + Topics.reply = function(data, callback) { + var tid = data.topic_id, + uid = data.uid, + toPid = data.toPid, + content = data.content, + privileges, + postData; async.waterfall([ function(next) { @@ -170,7 +174,7 @@ var async = require('async'), return next(new Error('content-too-short')); } - posts.create(uid, tid, content, next); + posts.create({uid:uid, tid:tid, content:content, toPid:toPid}, next); }, function(data, next) { postData = data; From 6e5a6b8784658f834b948e94c6825b35637bee20 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 18:56:37 -0500 Subject: [PATCH 12/30] upgraded categories to sorted set, score is the order set from acp, check if category topic exists before posting --- public/src/modules/composer.js | 2 +- src/admin/categories.js | 4 ++- src/categories.js | 30 +++++++++------- src/categoryTools.js | 5 +++ src/posts.js | 32 ++++++++--------- src/socket.io/posts.js | 2 +- src/threadTools.js | 10 +----- src/topics.js | 30 +++++++++++----- src/upgrade.js | 66 ++++++++++++++++++++++++++++++---- 9 files changed, 127 insertions(+), 54 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 9c1bbf351c..45b8c2b974 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -736,7 +736,7 @@ define(['taskbar'], function(taskbar) { }, done); } else if (parseInt(postData.tid, 10) > 0) { socket.emit('posts.reply', { - topic_id: postData.tid, + tid: postData.tid, content: bodyEl.val(), toPid: postData.toPid }, done); diff --git a/src/admin/categories.js b/src/admin/categories.js index 333a22cf70..0522837a05 100644 --- a/src/admin/categories.js +++ b/src/admin/categories.js @@ -13,10 +13,12 @@ var db = require('./../database'), for (var key in category) { db.setObjectField('category:' + cid, key, category[key]); - if (key == 'name') { + if (key === 'name') { // reset slugs if name is updated var slug = cid + '/' + utils.slugify(category[key]); db.setObjectField('category:' + cid, 'slug', slug); + } else if (key === 'order') { + db.sortedSetAdd('categories:cid', category[key], cid); } } diff --git a/src/categories.js b/src/categories.js index 85315e103a..da9f84a8af 100644 --- a/src/categories.js +++ b/src/categories.js @@ -18,11 +18,10 @@ var db = require('./database'), Categories.create = function(data, callback) { db.incrObjectField('global', 'nextCid', function(err, cid) { if (err) { - return callback(err, null); + return callback(err); } var slug = cid + '/' + utils.slugify(data.name); - db.listAppend('categories:cid', cid); var category = { cid: cid, @@ -36,14 +35,20 @@ var db = require('./database'), topic_count: 0, disabled: 0, order: data.order, - link: "", + link: '', numRecentReplies: 2, class: 'col-md-3 col-xs-6', imageClass: 'default' }; - db.setObject('category:' + cid, category, function(err, data) { - callback(err, category); + db.setObject('category:' + cid, category, function(err) { + if(err) { + return callback(err); + } + + db.sortedSetAdd('categories:cid', data.order, cid); + + callback(null, category); }); }); }; @@ -132,6 +137,10 @@ var db = require('./database'), return callback(err); } + if (parseInt(topicCount, 10) === 0) { + return callback(null, 1); + } + user.getSettings(uid, function(err, settings) { if(err) { return callback(err); @@ -142,8 +151,8 @@ var db = require('./database'), }); }; - Categories.getAllCategories = function(current_user, callback) { - db.getListRange('categories:cid', 0, -1, function(err, cids) { + Categories.getAllCategories = function(uid, callback) { + db.getSortedSetRange('categories:cid', 0, -1, function(err, cids) { if(err) { return callback(err); } @@ -152,7 +161,7 @@ var db = require('./database'), return callback(null, {categories : []}); } - Categories.getCategories(cids, current_user, callback); + Categories.getCategories(cids, uid, callback); }); }; @@ -311,14 +320,11 @@ var db = require('./database'), async.map(cids, getCategory, function(err, categories) { if (err) { - winston.err(err); - return callback(err, null); + return callback(err); } categories = categories.filter(function(category) { return !!category; - }).sort(function(a, b) { - return parseInt(a.order, 10) - parseInt(b.order, 10); }); callback(null, { diff --git a/src/categoryTools.js b/src/categoryTools.js index 8dd2f6664e..454d87128b 100644 --- a/src/categoryTools.js +++ b/src/categoryTools.js @@ -2,9 +2,14 @@ var Groups = require('./groups'), User = require('./user'), async = require('async'), + db = require('./database'), CategoryTools = {}; +CategoryTools.exists = function(cid, callback) { + db.isSortedSetMember('categories:cid', cid, callback); +}; + CategoryTools.privileges = function(cid, uid, callback) { async.parallel({ "+r": function(next) { diff --git a/src/posts.js b/src/posts.js index fa3703a585..1ad0750d16 100644 --- a/src/posts.js +++ b/src/posts.js @@ -87,7 +87,7 @@ var db = require('./database'), function(postData, next) { postTools.parse(postData.content, function(err, content) { if(err) { - return next(err, null); + return next(err); } postData.content = content; @@ -303,24 +303,24 @@ var db = require('./database'), }); }, function(postData, next) { - if (postData.content) { - postTools.parse(postData.content, function(err, content) { - if(err) { - return next(err); - } + if (!postData.content) { + return next(null, postData); + } - if(stripTags) { - var s = S(content); - postData.content = s.stripTags.apply(s, utils.getTagsExcept(['img', 'i'])).s; - } else { - postData.content = content; - } + postTools.parse(postData.content, function(err, content) { + if(err) { + return next(err); + } + + if(stripTags) { + var s = S(content); + postData.content = s.stripTags.apply(s, utils.getTagsExcept(['img', 'i'])).s; + } else { + postData.content = content; + } - next(null, postData); - }); - } else { next(null, postData); - } + }); } ], callback); } diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 2b54551554..c1b4dc9aaf 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -25,7 +25,7 @@ SocketPosts.reply = function(socket, data, callback) { return callback(new Error('not-logged-in')); } - if(!data || !data.topic_id || !data.content) { + if(!data || !data.tid || !data.content) { return callback(new Error('invalid data')); } diff --git a/src/threadTools.js b/src/threadTools.js index f99f5f7ef6..b9fde04bc5 100644 --- a/src/threadTools.js +++ b/src/threadTools.js @@ -18,15 +18,7 @@ var winston = require('winston'), (function(ThreadTools) { ThreadTools.exists = function(tid, callback) { - - db.isSortedSetMember('topics:tid', tid, function(err, ismember) { - - if (err) { - callback(false); - } - - callback(ismember); - }); + db.isSortedSetMember('topics:tid', tid, callback); } ThreadTools.privileges = function(tid, uid, callback) { diff --git a/src/topics.js b/src/topics.js index b7e22871a5..51a7008ef9 100644 --- a/src/topics.js +++ b/src/topics.js @@ -106,6 +106,12 @@ var async = require('async'), async.waterfall([ function(next) { + categoryTools.exists(cid, next); + }, + function(categoryExists, next) { + if(!categoryExists) { + return next(new Error('category doesn\'t exist')) + } categoryTools.privileges(cid, uid, next); }, function(privileges, next) { @@ -144,7 +150,7 @@ var async = require('async'), }; Topics.reply = function(data, callback) { - var tid = data.topic_id, + var tid = data.tid, uid = data.uid, toPid = data.toPid, content = data.content, @@ -153,6 +159,12 @@ var async = require('async'), async.waterfall([ function(next) { + threadTools.exists(tid, next); + }, + function(topicExists, next) { + if (!topicExists) { + return next(new Error('topic doesn\'t exist')); + } threadTools.privileges(tid, uid, next); }, function(privilegesData, next) { @@ -265,9 +277,9 @@ var async = require('async'), }; Topics.movePostToTopic = function(pid, tid, callback) { - threadTools.exists(tid, function(exists) { - if(!exists) { - return callback(new Error('Topic doesn\'t exist')); + threadTools.exists(tid, function(err, exists) { + if(err || !exists) { + return callback(err || new Error('Topic doesn\'t exist')); } posts.getPostFields(pid, ['deleted', 'tid', 'timestamp'], function(err, postData) { @@ -426,7 +438,9 @@ var async = require('async'), if(err) { return callback(err); } - + if(!parseInt(postCount, 10)) { + return callback(null, 1); + } user.getSettings(uid, function(err, settings) { if(err) { return callback(err); @@ -762,9 +776,9 @@ var async = require('async'), }; Topics.getTopicWithPosts = function(tid, current_user, start, end, quiet, callback) { - threadTools.exists(tid, function(exists) { - if (!exists) { - return callback(new Error('Topic tid \'' + tid + '\' not found')); + threadTools.exists(tid, function(err, exists) { + if (err || !exists) { + return callback(err || new Error('Topic tid \'' + tid + '\' not found')); } // "quiet" is used for things like RSS feed updating, HTML parsing for non-js users, etc diff --git a/src/upgrade.js b/src/upgrade.js index 41076ef259..26a3900644 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -7,6 +7,7 @@ var db = require('./database'), User = require('./user'), Topics = require('./topics'), Posts = require('./posts'), + Categories = require('./categories'), Groups = require('./groups'), Meta = require('./meta'), Plugins = require('./plugins'), @@ -19,7 +20,7 @@ var db = require('./database'), Upgrade.check = function(callback) { // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema - var latestSchema = new Date(2014, 1, 20, 20, 25).getTime(); + var latestSchema = new Date(2014, 1, 22).getTime(); db.get('schemaDate', function(err, value) { if (parseInt(value, 10) >= latestSchema) { @@ -691,7 +692,7 @@ Upgrade.upgrade = function(callback) { if (schemaDate < thisSchemaDate) { updatesMade = true; - + db.setObjectField('widgets:home.tpl', 'motd', JSON.stringify([ { "widget": "html", @@ -717,9 +718,9 @@ Upgrade.upgrade = function(callback) { if (schemaDate < thisSchemaDate) { updatesMade = true; - + var container = '
    {title}
    {body}
    '; - + db.setObjectField('widgets:category.tpl', 'sidebar', JSON.stringify([ { "widget": "recentreplies", @@ -756,7 +757,7 @@ Upgrade.upgrade = function(callback) { if (schemaDate < thisSchemaDate) { updatesMade = true; - + db.setObjectField('widgets:home.tpl', 'footer', JSON.stringify([ { "widget": "forumstats", @@ -778,7 +779,7 @@ Upgrade.upgrade = function(callback) { updatesMade = true; var container = '
    {title}
    {body}
    '; - + db.setObjectField('widgets:home.tpl', 'sidebar', JSON.stringify([ { "widget": "html", @@ -813,6 +814,59 @@ Upgrade.upgrade = function(callback) { winston.info('[2014/2/20] Activating NodeBB Essential Widgets - skipped'); next(); } + }, + function(next) { + thisSchemaDate = new Date(2014, 1, 22).getTime(); + + if (schemaDate < thisSchemaDate) { + updatesMade = true; + + db.exists('categories:cid', function(err, exists) { + if(err) { + return next(err); + } + if(!exists) { + winston.info('[2014/2/22] Added categories to sorted set - skipped'); + return next(); + } + + db.getListRange('categories:cid', 0, -1, function(err, cids) { + if(err) { + return next(err); + } + + if(!Array.isArray(cids)) { + winston.info('[2014/2/22] Add categories to sorted set - skipped (cant find any cids)'); + return next(); + } + + db.rename('categories:cid', 'categories:cid:old', function(err) { + if(err) { + return next(err); + } + + async.each(cids, function(cid, next) { + Categories.getCategoryField(cid, 'order', function(err, order) { + if(err) { + return next(err); + } + db.sortedSetAdd('categories:cid', order, cid, next); + }); + }, function(err) { + if(err) { + return next(err); + } + winston.info('[2014/2/22] Added categories to sorted set'); + db.delete('categories:cid:old', next); + }); + }); + }); + }); + + } else { + winston.info('[2014/2/22] Added categories to sorted set - skipped'); + next(); + } } // Add new schema updates here // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!! From a29ea2759637f577d296890b2f2e345c7df09b30 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 22 Feb 2014 22:46:58 -0500 Subject: [PATCH 13/30] closes #1106 --- src/socket.io/user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/socket.io/user.js b/src/socket.io/user.js index 2e9cf32d73..05fa97fcb0 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -1,6 +1,7 @@ var async = require('async'), user = require('../user'), topics = require('../topics'), + utils = require('./../../public/src/utils'), SocketUser = {}; SocketUser.exists = function(socket, data, callback) { From 8ef59adb4a2334569426415eadeab226f7cb178f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Del=20Rinc=C3=B3n=20L=C3=B3pez?= Date: Sun, 23 Feb 2014 14:38:50 +0100 Subject: [PATCH 14/30] =?UTF-8?q?Actualizaci=C3=B3n=20lenguaje=20espa?= =?UTF-8?q?=C3=B1ol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The translation was very faulty with a lack of accents and some words untranslated --- public/language/es/global.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/public/language/es/global.json b/public/language/es/global.json index c8c4addfd6..8fa7474ad2 100644 --- a/public/language/es/global.json +++ b/public/language/es/global.json @@ -4,23 +4,23 @@ "buttons.close": "Cerrar", "403.title": "Acceso denegado", "403.message": "Al parecer no tienes premisos necesarios para estar en este lugar. Tal vez puedes intentar conectarte?", - "404.title": "Ups... 404, no se encontra che!", + "404.title": "Ups... 404, no se encontró lo que buscabas!", "404.message": "Al parecer lo que estas buscando no existe. Te recomendamos que vuelvas al inicio.", "500.title": "Error Interno.", "500.message": "Ooops! Algo salio mal!, No te alarmes. Nuestros simios hiperinteligentes lo solucionarán", "register": "Registrarse", "login": "Conectarse", - "welcome_back": "Bienvenido de nuevo !", + "welcome_back": "Bienvenido de nuevo!", "you_have_successfully_logged_in": "Te has conectado!", "logout": "Salir", "logout.title": "Te has desconectado.", - "logout.message": "Haz sido desconectado correctamente", + "logout.message": "Has sido desconectado correctamente", "save_changes": "Guardar Cambios", "close": "Cerrar", "pagination": "Paginación", - "header.admin": "Admin", + "header.admin": "Administración", "header.recent": "Recientes", - "header.unread": "No Leeidos", + "header.unread": "No Leídos", "header.popular": "Popular", "header.users": "Miembros", "header.chats": "Chats", @@ -29,28 +29,28 @@ "header.profile": "Perfil", "notifications.loading": "Cargando Notificaciones", "chats.loading": "Cargando Chats", - "motd.welcome": "Bienvenido a NodeBB, la plataforma de debate sobre el futuro.", + "motd.welcome": "Bienvenido a NodeBB, la plataforma de debate del el futuro.", "motd.get": "Obtener NodeBB", - "motd.fork": "Fork", + "motd.fork": "Bifurcación", "motd.like": "Me gusta", "motd.follow": "Seguir", - "previouspage": "Pagina Anterior", - "nextpage": "Siguente Pagina", - "alert.success": "Exito!", + "previouspage": "Página Anterior", + "nextpage": "Siguente Página", + "alert.success": "Éxito!", "alert.error": "Error", - "alert.banned": "Banneado", - "alert.banned.message": "Estas banneado, seras desconectado!", - "alert.unfollow": "Ya no estas siguiendo a %1!", - "alert.follow": "Estas siguiendo a %1!", - "posts": "Posts", + "alert.banned": "Baneado", + "alert.banned.message": "Estás baneado, serás desconectado!", + "alert.unfollow": "Ya no estás siguiendo a %1!", + "alert.follow": "Estás siguiendo a %1!", + "posts": "Publicaciones", "views": "Visitas", "posted": "publicado", "in": "en", - "recentposts": "Posteos Recientes", + "recentposts": "Publicaciones Recientes", "online": "Conectado", "away": "No disponible", "dnd": "No molestar", "invisible": "Invisible", "offline": "Desconectado", "privacy": "Privacidad" -} \ No newline at end of file +} From 8111b9e91f53e3451e3e51a874bc64cbafcd1599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Del=20Rinc=C3=B3n?= Date: Sun, 23 Feb 2014 15:00:52 +0100 Subject: [PATCH 15/30] Finally reviewed spanish transalation I revised the spanish translation to something more serious and complete. There was a lot of wrong spelled words and some untranslated/bad translated words --- public/language/es/category.json | 2 +- public/language/es/footer.json | 4 +- public/language/es/login.json | 4 +- public/language/es/modules.json | 2 +- public/language/es/notifications.json | 2 +- public/language/es/pages.json | 22 +++++------ public/language/es/recent.json | 2 +- public/language/es/register.json | 14 +++---- public/language/es/reset_password.json | 14 +++---- public/language/es/topic.json | 52 +++++++++++++------------- public/language/es/unread.json | 4 +- public/language/es/user.json | 32 ++++++++-------- public/language/es/users.json | 6 +-- 13 files changed, 80 insertions(+), 80 deletions(-) diff --git a/public/language/es/category.json b/public/language/es/category.json index 4829fb6f60..d75bf5e916 100644 --- a/public/language/es/category.json +++ b/public/language/es/category.json @@ -9,6 +9,6 @@ "posted": "posted", "browsing": "viendo ahora", "no_replies": "Nadie ha respondido aún", - "replied": "respondio", + "replied": "respondió", "last_edited_by": "ultima edición por" } \ No newline at end of file diff --git a/public/language/es/footer.json b/public/language/es/footer.json index 10d3638430..48f2274776 100644 --- a/public/language/es/footer.json +++ b/public/language/es/footer.json @@ -2,6 +2,6 @@ "stats.online": "Online", "stats.users": "Gente", "stats.topics": "Temas", - "stats.posts": "Posts", - "success": "exito!" + "stats.posts": "Publicaciones", + "success": "éxito!" } \ No newline at end of file diff --git a/public/language/es/login.json b/public/language/es/login.json index 9093fb3c8a..2a94c0b96c 100644 --- a/public/language/es/login.json +++ b/public/language/es/login.json @@ -5,6 +5,6 @@ "remember_me": "Recordarme?", "forgot_password": "Olvidaste tu contraseña?", "alternative_logins": "Conexiones Alternativas", - "failed_login_attempt": "Error al loguearte, intenta de nuevo.", - "login_successful": "Te has conectado con exito!" + "failed_login_attempt": "Error al iniciar sesión, intenta otra vez.", + "login_successful": "Te has conectado con éxito!" } \ No newline at end of file diff --git a/public/language/es/modules.json b/public/language/es/modules.json index dd945e8ed4..e3f2652032 100644 --- a/public/language/es/modules.json +++ b/public/language/es/modules.json @@ -1,6 +1,6 @@ { "chat.chatting_with": "Chatear con ", - "chat.placeholder": "ingresa tu mensaje aqui, y presiona enter para enviar", + "chat.placeholder": "ingresa tu mensaje aquí, y presiona Intro para enviar", "chat.send": "Enviar", "chat.no_active": "No tiene conversaciones activas." } \ No newline at end of file diff --git a/public/language/es/notifications.json b/public/language/es/notifications.json index 9fb44b2aef..e7b072975d 100644 --- a/public/language/es/notifications.json +++ b/public/language/es/notifications.json @@ -3,7 +3,7 @@ "no_notifs": "No tiene nuevas notificaciones", "see_all": "Ver todas las notificaciones", "back_to_home": "Volver al Inicio", - "outgoing_link": "Link Externo", + "outgoing_link": "Enlace Externo", "outgoing_link_message": "Estas saliendo del sitio", "continue_to": "Continuar", "return_to": "Volver a " diff --git a/public/language/es/pages.json b/public/language/es/pages.json index d60e0a0a9b..6d91d53482 100644 --- a/public/language/es/pages.json +++ b/public/language/es/pages.json @@ -1,13 +1,13 @@ { - "home": "Home", - "unread": "Unread Topics", - "popular": "Popular Topics", - "recent": "Recent Topics", - "users": "Registered Users", - "notifications": "Notifications", - "user.edit": "Editing \"%1\"", - "user.following": "People %1 Follows", - "user.followers": "People who Follow %1", - "user.favourites": "%1's Favourite Posts", - "user.settings": "User Settings" + "home": "Inicio", + "unread": "Temas No Leídos", + "popular": "Temas Populares", + "recent": "Temas Recientes", + "users": "Usuarios Registrado", + "notifications": "Notificaciones", + "user.edit": "Editando \"%1\"", + "user.following": "Gente que sigue %1 ", + "user.followers": "Seguidores de %1", + "user.favourites": "Publicaciones favoritas de %1 ", + "user.settings": "Preferencias del Usuario" } \ No newline at end of file diff --git a/public/language/es/recent.json b/public/language/es/recent.json index 63a9d990f6..99fb134ad2 100644 --- a/public/language/es/recent.json +++ b/public/language/es/recent.json @@ -3,5 +3,5 @@ "day": "Día", "week": "Semana", "month": "Mes", - "no_recent_topics": "No hay posts recientes" + "no_recent_topics": "No hay publicaciones recientes" } \ No newline at end of file diff --git a/public/language/es/register.json b/public/language/es/register.json index 0e276d70c7..542d04310f 100644 --- a/public/language/es/register.json +++ b/public/language/es/register.json @@ -1,10 +1,10 @@ { "register": "Registrase", - "help.email": "Por defecto, tu email será oculto al publico.", - "help.username_restrictions": "El nombre de usuario debe tener entre %1 y %2 caracteres. Los miembros pueden responderte escribiendo @usuario.", - "help.minimum_password_length": "Tu contraseña debe tener al menos %1 caracteres.", - "email_address": "Email", - "email_address_placeholder": "Escribe tu email", + "help.email": "Por defecto, tu cuenta de correo electrónico será oculto al publico.", + "help.username_restrictions": "El nombre de usuario debe tener entre %1 y %2 carácteres. Los miembros pueden responderte escribiendo @usuario.", + "help.minimum_password_length": "Tu contraseña debe tener al menos %1 carácteres.", + "email_address": "Correo electrónico", + "email_address_placeholder": "Escribe tu correo electrónico", "username": "Usuario", "username_placeholder": "Escribe tu usuario", "password": "Contraseña", @@ -12,7 +12,7 @@ "confirm_password": "Confirmar Contraseña", "confirm_password_placeholder": "Confirmar Contraseña", "register_now_button": "Registrarme ahora", - "alternative_registration": "Otros metodos interesantes para registrarse", + "alternative_registration": "Otros métodos interesantes para registrarse", "terms_of_use": "Términos y Condiciones de uso", - "agree_to_terms_of_use": "Acepto los Terminos y condiciones de uso" + "agree_to_terms_of_use": "Acepto los Términos y Condiciones de uso" } \ No newline at end of file diff --git a/public/language/es/reset_password.json b/public/language/es/reset_password.json index 967680359e..99ca4a0f0c 100644 --- a/public/language/es/reset_password.json +++ b/public/language/es/reset_password.json @@ -1,13 +1,13 @@ { - "reset_password": "Resetear Contraseña", + "reset_password": "Reiniciar Contraseña", "update_password": "Actualizar contraseña", "password_changed.title": "Contraseña editada", - "password_changed.message": "

    La contraseña fue modificada con exito, por favor conectate de nuevo.", - "wrong_reset_code.title": "Código de Reseteo Incorrecto", - "wrong_reset_code.message": "El código de reseteo ingresado no es correcto. Por favor intentalo de nuevo o pide un nuevo código.", + "password_changed.message": "

    La contraseña fue modificada con éxito, por favor inicia sesión de nuevo.", + "wrong_reset_code.title": "Código de reinicio Incorrecto", + "wrong_reset_code.message": "El código de reinicio ingresado no es correcto. Por favor inténtalo de nuevo o pide un nuevo código.", "new_password": "Nueva Contraseña", "repeat_password": "Confirmar Contraseña", - "enter_email": "Por favor ingresa tu email y te enviaremos un email de como resetear tu cuenta.", - "password_reset_sent": "Resteo de contraseña enviado", - "invalid_email": "Email Invalido o no existe!" + "enter_email": "Por favor ingresa tu correo electrónico y te enviaremos un correo con indicaciones para inicializar tu cuenta.", + "password_reset_sent": "Reinicio de contraseña enviado", + "invalid_email": "Correo Electrónico no válido o inexistente!" } \ No newline at end of file diff --git a/public/language/es/topic.json b/public/language/es/topic.json index f631139043..5997346b23 100644 --- a/public/language/es/topic.json +++ b/public/language/es/topic.json @@ -2,62 +2,62 @@ "topic": "Tema", "topics": "Temas", "no_topics_found": "No se encontraron temas!", - "no_posts_found": "No se encontraron posts!", + "no_posts_found": "No se encontraron publicaciones!", "profile": "Perfil", "posted_by": "Publicado por", "chat": "Chat", - "notify_me": "Seras notificado cuando haya nuevas respuestas en este tema", + "notify_me": "Serás notificado cuando haya nuevas respuestas en este tema", "quote": "Citar", "reply": "Responder", "edit": "Editar", "delete": "Borrar", "move": "Mover", - "fork": "Forkear", - "banned": "banneado", + "fork": "Bifurcar", + "banned": "baneado", "link": "Link", "share": "Compartir", "tools": "Herramientas", "flag": "Reportar", - "flag_title": "Reportar este post a los moderadores", + "flag_title": "Reportar esta publicación a los moderadores", "deleted_message": "Este tema ha sido borrado. Solo los miembros con privilegios pueden verlo.", "watch": "Seguir", "share_this_post": "Compartir este post", "thread_tools.title": "Herramientas del Tema", - "thread_tools.markAsUnreadForAll": "Marcar como no leido", + "thread_tools.markAsUnreadForAll": "Marcar como no leído", "thread_tools.pin": "Tema Importante", "thread_tools.unpin": "Quitar Importante", "thread_tools.lock": "Cerrar Tema", "thread_tools.unlock": "Abrir Tema", "thread_tools.move": "Mover Tema", - "thread_tools.fork": "Fork Topic", + "thread_tools.fork": "Bifurcar Tema", "thread_tools.delete": "Borrar Tema", "thread_tools.restore": "Restaurar Tema", - "load_categories": "Cargando Categorias", - "disabled_categories_note": "Las categorías deshabilidas estan en gris", + "load_categories": "Cargando Categoríaas", + "disabled_categories_note": "Las categorías deshabilitadas estan en gris", "confirm_move": "Mover", - "confirm_fork": "Forkear", + "confirm_fork": "Bifurcar", "favourite": "Favorito", "favourites": "Favoritos", - "favourites.not_logged_in.title": "No estas conectado :(", - "favourites.not_logged_in.message": "Por favor, conectate para agregar a favorito este post.", - "favourites.has_no_favourites": "No tienes favoritos, puedes agregar alguno y volver a verlos aqui!", - "vote.not_logged_in.title": "No estas conectado", - "vote.not_logged_in.message": "Por favor conectate para votar...", - "vote.cant_vote_self.title": "Voto Invalido", - "vote.cant_vote_self.message": "No puedes votar tus propios posts, palurdo!", - "loading_more_posts": "Cargando más posts", + "favourites.not_logged_in.title": "No estás conectado :(", + "favourites.not_logged_in.message": "Por favor, conáctate para agregar a favoritos esta publicación.", + "favourites.has_no_favourites": "No tienes favoritos, puedes agregar alguno y volver a verlos aquí!", + "vote.not_logged_in.title": "No estás conectado", + "vote.not_logged_in.message": "Por favor conéctate para votar...", + "vote.cant_vote_self.title": "Voto Inválido", + "vote.cant_vote_self.message": "No puedes votar tus propias publicaciones!", + "loading_more_posts": "Cargando más publicaciones", "move_topic": "Mover Tema", - "move_post": "Mover post", - "fork_topic": "Forkear Tema", - "topic_will_be_moved_to": "Este tema sera movido a la categoría", - "fork_topic_instruction": "Click en los posts que quieres forkear", - "fork_no_pids": "No seleccionaste posts!", - "fork_success": "Forkeado con exito!", + "move_post": "Mover Publicación", + "fork_topic": "Bifurcar Tema", + "topic_will_be_moved_to": "Este tema será movido a la categoría", + "fork_topic_instruction": "Click en las publicaciones que quieres bifurcar", + "fork_no_pids": "No seleccionaste publicaciones!", + "fork_success": "Bifurcado con exito!", "reputation": "Reputación", - "posts": "Posts", + "posts": "Publicaciones", "composer.title_placeholder": "Ingresa el titulo de tu tema", "composer.write": "Escribe", - "composer.preview": "Preview", + "composer.preview": "Previsualización", "composer.discard": "Descartar", "composer.submit": "Enviar", "composer.replying_to": "Respondiendo a", diff --git a/public/language/es/unread.json b/public/language/es/unread.json index c7fb8c5aa8..b06f14f687 100644 --- a/public/language/es/unread.json +++ b/public/language/es/unread.json @@ -1,6 +1,6 @@ { - "title": "No leeido", + "title": "No leído", "no_unread_topics": "No hay temas nuevos para leer.", - "mark_all_read": "Marcar todo como leeido", + "mark_all_read": "Marcar todo como leído", "load_more": "Cargar más" } \ No newline at end of file diff --git a/public/language/es/user.json b/public/language/es/user.json index 2aaa6da119..c7ef7ae029 100644 --- a/public/language/es/user.json +++ b/public/language/es/user.json @@ -1,18 +1,18 @@ { - "banned": "Banneado", + "banned": "Baneado", "offline": "Desconectado", "username": "Usuario", - "email": "Email", + "email": "Correo Electrónico", "fullname": "Nombre", - "website": "Website", + "website": "Sitio Web", "location": "Ubicación", "age": "Edad", "joined": "Registro", - "lastonline": "Última vez online", + "lastonline": "Última vez conectado", "profile": "Perfil", "profile_views": "Visitas", "reputation": "Reputación", - "posts": "Posts", + "posts": "Publicaciones", "favourites": "Favoritos", "followers": "Seguidores", "following": "Sigue", @@ -26,22 +26,22 @@ "edit": "Editar", "uploaded_picture": "Fotos Cargadas", "upload_new_picture": "Cargar Nueva Foto", - "current_password": "Password actual", + "current_password": "Contraseña actual", "change_password": "Cambiar Contraseña", "confirm_password": "Confirmar Contraseña", "password": "Contraseña", "upload_picture": "Cargar foto", "upload_a_picture": "Cargar una foto", - "image_spec": "Solo puedes subir, PNG, JPG o Archivos GIF.", - "max": "max.", + "image_spec": "Sólo puedes subir imágenes en formato PNG, JPG o GIF.", + "max": "máx.", "settings": "Opciones", - "show_email": "Mostrar mi Email", - "has_no_follower": "Este miembro no tiene seguidores :(", - "follows_no_one": "Este miembro no sigue a nadie, que pena :(", - "has_no_posts": "Este usuario aun no ha publicado nada.", - "email_hidden": "Email Oculto", + "show_email": "Mostrar mi Correo electrónico", + "has_no_follower": "Este miembro no tiene seguidores.", + "follows_no_one": "Este miembro no sigue a nadie.", + "has_no_posts": "Este usuario aún no ha publicado nada.", + "email_hidden": "Correo electrónico Oculto", "hidden": "oculto", - "paginate_description": "La paginación de los temas no es por pagina, ya que tiene scroll infinito.", - "topics_per_page": "Temas por pagina", - "posts_per_page": "Post por pagina" + "paginate_description": "La paginación de los temas no es por página, ya que tiene scroll infinito.", + "topics_per_page": "Temas por página", + "posts_per_page": "Post por página" } \ No newline at end of file diff --git a/public/language/es/users.json b/public/language/es/users.json index f1c3007347..5e39c9cb55 100644 --- a/public/language/es/users.json +++ b/public/language/es/users.json @@ -1,9 +1,9 @@ { - "latest_users": "Ultimos Miembros", - "top_posters": "Top Posteadores", + "latest_users": "Últimos Miembros", + "top_posters": "Top Publicadores", "most_reputation": "Mayor Reputación", "online": "Conectados", "search": "Buscar", - "enter_username": "Ingresa el nombre de usuario para buscar", + "enter_username": "Ingresa el nombre de usuario que quieres buscar", "load_more": "Cargar más" } \ No newline at end of file From a9f20a77912d271cbda76ee9a76a8346706a4584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Del=20Rinc=C3=B3n?= Date: Sun, 23 Feb 2014 15:11:10 +0100 Subject: [PATCH 16/30] More translation --- public/language/es/topic.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/language/es/topic.json b/public/language/es/topic.json index 5997346b23..d826369a84 100644 --- a/public/language/es/topic.json +++ b/public/language/es/topic.json @@ -32,7 +32,7 @@ "thread_tools.fork": "Bifurcar Tema", "thread_tools.delete": "Borrar Tema", "thread_tools.restore": "Restaurar Tema", - "load_categories": "Cargando Categoríaas", + "load_categories": "Cargando Categorías", "disabled_categories_note": "Las categorías deshabilitadas estan en gris", "confirm_move": "Mover", "confirm_fork": "Bifurcar", From 6c6c57f45f4a343c54c5bcd58c023796729c40ae Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 15:07:47 -0500 Subject: [PATCH 17/30] closes #1108 --- public/language/en_GB/topic.json | 1 + public/src/forum/topic.js | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json index f51b3f4d33..e03bada393 100644 --- a/public/language/en_GB/topic.json +++ b/public/language/en_GB/topic.json @@ -13,6 +13,7 @@ "reply": "Reply", "edit": "Edit", "delete": "Delete", + "restore": "Restore", "move": "Move", "fork": "Fork", "banned": "banned", diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index e9fa69e934..6536905897 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -978,7 +978,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { function set_delete_state(deleted) { var deleteThreadEl = $('.delete_thread'), deleteTextEl = $('.delete_thread span'), - //deleteThreadEl.getElementsByTagName('span')[0], threadEl = $('#post-container'), deleteNotice = document.getElementById('thread-deleted') || document.createElement('div'); @@ -1053,23 +1052,16 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } function toggle_post_tools(pid, isDeleted) { - var postEl = $('#post-container li[data-pid="' + pid + '"]'), - quoteEl = $(postEl[0].querySelector('.quote')), - favEl = $(postEl[0].querySelector('.favourite')), - replyEl = $(postEl[0].querySelector('.post_reply')), - chatEl = $(postEl[0].querySelector('.chat')); - - if (isDeleted) { - quoteEl.addClass('none'); - favEl.addClass('none'); - replyEl.addClass('none'); - chatEl.addClass('none'); - } else { - quoteEl.removeClass('none'); - favEl.removeClass('none'); - replyEl.removeClass('none'); - chatEl.removeClass('none'); - } + var postEl = $('#post-container li[data-pid="' + pid + '"]'); + + postEl.find('.quote').toggleClass('none', isDeleted); + postEl.find('.favourite').toggleClass('none', isDeleted); + postEl.find('.post_reply').toggleClass('none', isDeleted); + postEl.find('.chat').toggleClass('none', isDeleted); + + translator.translate(isDeleted ? ' [[topic:restore]]' : ' [[topic:delete]]', function(translated) { + postEl.find('.delete').find('span').html(translated); + }); } $(window).on('scroll', updateHeader); From c1e3d95a84326dc45eb1a1daea52c4376b3d1658 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 16:19:30 -0500 Subject: [PATCH 18/30] upgrade fix for new installs --- src/upgrade.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 26a3900644..45d146a116 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -23,6 +23,13 @@ Upgrade.check = function(callback) { var latestSchema = new Date(2014, 1, 22).getTime(); db.get('schemaDate', function(err, value) { + if(!value) { + db.set('schemaDate', latestSchema, function(err) { + callback(true); + }); + return; + } + if (parseInt(value, 10) >= latestSchema) { callback(true); } else { @@ -40,7 +47,7 @@ Upgrade.upgrade = function(callback) { function(next) { // Prepare for upgrade & check to make sure the upgrade is possible db.get('schemaDate', function(err, value) { - schemaDate = value; + schemaDate = parseInt(value, 10); if (schemaDate >= minSchemaDate || schemaDate === null) { next(); From 2088903358fe9d574247424ff17aa9e8bfed1d5e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 23 Feb 2014 16:35:28 -0500 Subject: [PATCH 19/30] added check to upgrade.upgrade --- app.js | 2 +- src/upgrade.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 57cb4dcc02..8ad89c8ade 100644 --- a/app.js +++ b/app.js @@ -232,7 +232,7 @@ function reset() { winston.info("Successfully reset theme to Vanilla and disabled all plugins."); } - process.exit(); + process.exit(); }); }); }); diff --git a/src/upgrade.js b/src/upgrade.js index 45d146a116..6aad843f05 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -16,12 +16,12 @@ var db = require('./database'), Upgrade = {}, minSchemaDate = new Date(2014, 0, 4).getTime(), // This value gets updated every new MINOR version - schemaDate, thisSchemaDate; + schemaDate, thisSchemaDate, -Upgrade.check = function(callback) { // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema - var latestSchema = new Date(2014, 1, 22).getTime(); + latestSchema = new Date(2014, 1, 22).getTime(); +Upgrade.check = function(callback) { db.get('schemaDate', function(err, value) { if(!value) { db.set('schemaDate', latestSchema, function(err) { @@ -47,9 +47,16 @@ Upgrade.upgrade = function(callback) { function(next) { // Prepare for upgrade & check to make sure the upgrade is possible db.get('schemaDate', function(err, value) { - schemaDate = parseInt(value, 10); + if(!value) { + db.set('schemaDate', latestSchema, function(err) { + next(); + }); + schemaDate = latestSchema; + } else { + schemaDate = parseInt(value, 10); + } - if (schemaDate >= minSchemaDate || schemaDate === null) { + if (schemaDate >= minSchemaDate) { next(); } else { next(new Error('upgrade-not-possible')); @@ -876,7 +883,7 @@ Upgrade.upgrade = function(callback) { } } // Add new schema updates here - // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!! + // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 22!!! ], function(err) { if (!err) { db.set('schemaDate', thisSchemaDate, function(err) { @@ -886,6 +893,7 @@ Upgrade.upgrade = function(callback) { } else { winston.info('[upgrade] Schema already up to date!'); } + if (callback) { callback(err); } else { From 122d1ad82a63d22274d7990553d08a999d54fb2e Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 17:42:31 -0500 Subject: [PATCH 20/30] less is more --- public/src/forum/topic.js | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 6536905897..9313333c90 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1006,36 +1006,19 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } function set_pinned_state(pinned, alert) { - var pinEl = $('.pin_thread'); - translator.translate(' [[topic:thread_tools.' + (pinned ? 'unpin' : 'pin') + ']]', function(translated) { - if (pinned) { - pinEl.html(translated); - if (alert) { - app.alert({ - 'alert_id': 'thread_pin', - type: 'success', - title: 'Thread Pinned', - message: 'Thread has been successfully pinned', - timeout: 5000 - }); - } - - thread_state.pinned = '1'; - } else { - pinEl.html(translated); - if (alert) { - app.alert({ - 'alert_id': 'thread_pin', - type: 'success', - title: 'Thread Unpinned', - message: 'Thread has been successfully unpinned', - timeout: 5000 - }); - } + $('.pin_thread').html(translated); - thread_state.pinned = '0'; + if (alert) { + app.alert({ + 'alert_id': 'thread_pin', + type: 'success', + title: 'Thread ' + (pinned ? 'Pinned' : 'Unpinned'), + message: 'Thread has been successfully ' + (pinned ? 'pinned' : 'unpinned'), + timeout: 5000 + }); } + thread_state.pinned = pinned ? '1' : '0'; }); } From 403de08d602b7e0fbd8d77e95f16402c570efeee Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 18:05:50 -0500 Subject: [PATCH 21/30] cleaned more --- public/src/forum/topic.js | 70 +++++++++------------------------------ 1 file changed, 16 insertions(+), 54 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 9313333c90..cf2ec408d4 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -915,64 +915,26 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } function set_locked_state(locked, alert) { - var threadReplyBtn = $('.topic-main-buttons .post_reply'), - postReplyBtns = document.querySelectorAll('#post-container .post_reply'), - quoteBtns = document.querySelectorAll('#post-container .quote'), - editBtns = document.querySelectorAll('#post-container .edit'), - deleteBtns = document.querySelectorAll('#post-container .delete'), - numPosts = document.querySelectorAll('#post_container li[data-pid]').length, - lockThreadEl = $('.lock_thread'), - x; - - if (locked === true) { - translator.translate(' [[topic:thread_tools.unlock]]', function(translated) { - lockThreadEl.html(translated); - }); - threadReplyBtn.attr('disabled', true); - threadReplyBtn.html('Locked '); - for (x = 0; x < numPosts; x++) { - postReplyBtns[x].innerHTML = 'Locked '; - quoteBtns[x].style.display = 'none'; - editBtns[x].style.display = 'none'; - deleteBtns[x].style.display = 'none'; - } + translator.translate(' [[topic:thread_tools.' + (locked ? 'un': '') + 'lock]]', function(translated) { + $('.lock_thread').html(translated); + }); - if (alert) { - app.alert({ - 'alert_id': 'thread_lock', - type: 'success', - title: 'Thread Locked', - message: 'Thread has been successfully locked', - timeout: 5000 - }); - } + $('.topic-main-buttons .post_reply').attr('disabled', locked).html(locked ? 'Locked ' : 'Reply'); - thread_state.locked = '1'; - } else { - translator.translate(' [[topic:thread_tools.lock]]', function(translated) { - lockThreadEl.html(translated); - }); - threadReplyBtn.attr('disabled', false); - threadReplyBtn.html('Reply'); - for (x = 0; x < numPosts; x++) { - postReplyBtns[x].innerHTML = 'Reply '; - quoteBtns[x].style.display = 'inline-block'; - editBtns[x].style.display = 'inline-block'; - deleteBtns[x].style.display = 'inline-block'; - } - - if (alert) { - app.alert({ - 'alert_id': 'thread_lock', - type: 'success', - title: 'Thread Unlocked', - message: 'Thread has been successfully unlocked', - timeout: 5000 - }); - } + $('#post-container .post_reply').html(locked ? 'Locked ' : 'Reply '); + $('#post-container').find('.quote, .edit, .delete').toggleClass('none', locked); - thread_state.locked = '0'; + if (alert) { + app.alert({ + 'alert_id': 'thread_lock', + type: 'success', + title: 'Thread ' + (locked ? 'Locked' : 'Unlocked'), + message: 'Thread has been successfully ' + (locked ? 'locked' : 'unlocked'), + timeout: 5000 + }); } + + thread_state.locked = locked ? '1' : '0'; } function set_delete_state(deleted) { From b5c8158ad5a513d715e773c3c36cf2fc61b5d93a Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 18:19:10 -0500 Subject: [PATCH 22/30] more cleanup --- public/src/forum/topic.js | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index cf2ec408d4..6a6b465eb4 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -938,32 +938,19 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } function set_delete_state(deleted) { - var deleteThreadEl = $('.delete_thread'), - deleteTextEl = $('.delete_thread span'), - threadEl = $('#post-container'), - deleteNotice = document.getElementById('thread-deleted') || document.createElement('div'); - - if (deleted) { - translator.translate(' [[topic:thread_tools.restore]]', function(translated) { - deleteTextEl.html(translated); - }); - threadEl.addClass('deleted'); + var threadEl = $('#post-container'); - // Spawn a 'deleted' notice at the top of the page - deleteNotice.setAttribute('id', 'thread-deleted'); - deleteNotice.className = 'alert alert-warning'; - deleteNotice.innerHTML = 'This thread has been deleted. Only users with thread management privileges can see it.'; - threadEl.before(deleteNotice); + translator.translate(' [[topic:thread_tools.' + (deleted ? 'restore' : 'delete') + ']]', function(translated) { + $('.delete_thread span').html(translated); + }); - thread_state.deleted = '1'; - } else { - translator.translate(' [[topic:thread_tools.delete]]', function(translated) { - deleteTextEl.html(translated); - }); - threadEl.removeClass('deleted'); - deleteNotice.parentNode.removeChild(deleteNotice); + threadEl.toggleClass('deleted', deleted); + thread_state.deleted = deleted ? '1' : '0'; - thread_state.deleted = '0'; + if(deleted) { + $('

    This thread has been deleted. Only users with thread management privileges can see it.
    ').insertBefore(threadEl); + } else { + $('#thread-deleted').remove(); } } @@ -999,10 +986,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { function toggle_post_tools(pid, isDeleted) { var postEl = $('#post-container li[data-pid="' + pid + '"]'); - postEl.find('.quote').toggleClass('none', isDeleted); - postEl.find('.favourite').toggleClass('none', isDeleted); - postEl.find('.post_reply').toggleClass('none', isDeleted); - postEl.find('.chat').toggleClass('none', isDeleted); + postEl.find('.quote, .favourite, .post_reply, .chat').toggleClass('none', isDeleted); translator.translate(isDeleted ? ' [[topic:restore]]' : ' [[topic:delete]]', function(translated) { postEl.find('.delete').find('span').html(translated); From 649bcf49b4bbfe9145e99d57f43fd686f3ef2789 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 18:25:24 -0500 Subject: [PATCH 23/30] one liner --- public/src/forum/topic.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 6a6b465eb4..eae49ab483 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1237,18 +1237,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } - function toggle_mod_tools(pid, state) { - var postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')), - editEl = postEl.find('.edit'), - deleteEl = postEl.find('.delete'); - - if (state) { - editEl.removeClass('none'); - deleteEl.removeClass('none'); - } else { - editEl.addClass('none'); - deleteEl.addClass('none'); - } + function toggle_mod_tools(pid, editable) { + $('#post-container li[data-pid="' + pid + '"]').find('.edit, .delete').toggleClass('none', !editable); } function updatePostCount() { From f967407805850d3fedf01795d9296b6d351b4bf1 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 18:38:46 -0500 Subject: [PATCH 24/30] follow state clean up --- public/src/forum/topic.js | 54 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index eae49ab483..33b6fbc4a2 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -280,41 +280,11 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { fixDeleteStateForPosts(); - // Follow Thread State - var followEl = $('.posts .follow'), - set_follow_state = function(state, quiet) { - if (state && !followEl.hasClass('btn-success')) { - followEl.addClass('btn-success'); - followEl.attr('title', 'You are currently receiving updates to this topic'); - if (!quiet) { - app.alert({ - alert_id: 'topic_follow', - timeout: 2500, - title: '[[topic:following_topic.title]]', - message: '[[topic:following_topic.message]]', - type: 'success' - }); - } - } else if (!state && followEl.hasClass('btn-success')) { - followEl.removeClass('btn-success'); - followEl.attr('title', 'Be notified of new replies in this topic'); - if (!quiet) { - app.alert({ - alert_id: 'topic_follow', - timeout: 2500, - title: '[[topic:not_following_topic.title]]', - message: '[[topic:not_following_topic.message]]', - type: 'success' - }); - } - } - }; - socket.emit('topics.followCheck', tid, function(err, state) { - set_follow_state(state, true); + set_follow_state(state, false); }); - followEl.on('click', function() { + $('.posts .follow').on('click', function() { socket.emit('topics.follow', tid, function(err, state) { if(err) { return app.alert({ @@ -326,7 +296,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { }); } - set_follow_state(state); + set_follow_state(state, true); }); return false; @@ -914,6 +884,21 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { favourites.html(currentFavourites).attr('data-favourites', currentFavourites); } + function set_follow_state(state, alert) { + + $('.posts .follow').toggleClass('btn-success', state).attr('title', state ? 'You are currently receiving updates to this topic' : 'Be notified of new replies in this topic'); + + if(alert) { + app.alert({ + alert_id: 'topic_follow', + timeout: 2500, + title: state ? '[[topic:following_topic.title]]' : '[[topic:not_following_topic.title]]', + message: state ? '[[topic:following_topic.message]]' : '[[topic:not_following_topic.message]]', + type: 'success' + }); + } + } + function set_locked_state(locked, alert) { translator.translate(' [[topic:thread_tools.' + (locked ? 'un': '') + 'lock]]', function(translated) { $('.lock_thread').html(translated); @@ -1057,8 +1042,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { var scrollBottom = scrollTop + $(window).height(); var elTop = el.offset().top; - var height = Math.floor(el.height()); - var elBottom = elTop + height; + var elBottom = elTop + Math.floor(el.height()); return !(elTop > scrollBottom || elBottom < scrollTop); } From b8b83c2ec2c28e3c334979ad60c7a15e1ad69c72 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 19:38:26 -0500 Subject: [PATCH 25/30] share buttons --- public/src/forum/category.js | 2 +- public/templates/category.tpl | 2 +- public/templates/topic.tpl | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index e9777904ab..09eacd8c55 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -12,7 +12,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { app.enterRoom('category_' + cid); - $('#twitter-intent').on('click', function () { + $('#twitter-share').on('click', function () { window.open(twitterUrl, '_blank', 'width=550,height=420,scrollbars=no,status=no'); return false; }); diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 418c8ca40b..c437ceac2d 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -14,7 +14,7 @@
      -   +    
    diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 20c8cb4b29..2bb43ff789 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -101,9 +101,9 @@