From c2ba1c270fd36ab940d0ef729e4e1a8adcd08106 Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Fri, 14 Apr 2017 09:22:18 +0000 Subject: [PATCH 01/11] Latest translations and fallbacks --- public/language/el/modules.json | 36 +++++++++++++------------- public/language/el/notifications.json | 32 +++++++++++------------ public/language/el/reset_password.json | 4 +-- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/public/language/el/modules.json b/public/language/el/modules.json index 3c85a388de..e2d45cd043 100644 --- a/public/language/el/modules.json +++ b/public/language/el/modules.json @@ -1,31 +1,31 @@ { - "chat.chatting_with": "Συνομιλία με τον/την ", - "chat.placeholder": "Γράψε το μήνυμά σου εδώ, πάτα enter για αποστολή", - "chat.send": "Αποστολή", - "chat.no_active": "Δεν έχεις ενεργές συνομιλίες.", - "chat.user_typing": "Ο/Η %1 πληκτρολογεί...", - "chat.user_has_messaged_you": "Ο/Η %1 σου έστειλε μήνυμα.", + "chat.chatting_with": "Chat with ", + "chat.placeholder": "Type chat message here, press enter to send", + "chat.send": "Send", + "chat.no_active": "You have no active chats.", + "chat.user_typing": "%1 is typing ...", + "chat.user_has_messaged_you": "%1 has messaged you.", "chat.see_all": "See all chats", "chat.mark_all_read": "Mark all chats read", - "chat.no-messages": "Παρακαλώ επέλεξε έναν παραλήπτη για να δείς το ιστορικό της συνομιλίας", + "chat.no-messages": "Please select a recipient to view chat message history", "chat.no-users-in-room": "No users in this room", - "chat.recent-chats": "Πρόσφατες Συνομιλίες", - "chat.contacts": "Επαφές", - "chat.message-history": "Ιστορικό Συνομιλίας", - "chat.pop-out": "Αποκόλληση συνομιλίας", + "chat.recent-chats": "Recent Chats", + "chat.contacts": "Contacts", + "chat.message-history": "Message History", + "chat.pop-out": "Pop out chat", "chat.minimize": "Minimize", - "chat.maximize": "Μεγιστοποίηση", - "chat.seven_days": "7 Ημέρες", - "chat.thirty_days": "30 Ημέρες", - "chat.three_months": "3 Μήνες", + "chat.maximize": "Maximize", + "chat.seven_days": "7 Days", + "chat.thirty_days": "30 Days", + "chat.three_months": "3 Months", "chat.delete_message_confirm": "Are you sure you wish to delete this message?", "chat.add-users-to-room": "Add users to room", "composer.compose": "Compose", "composer.show_preview": "Show Preview", "composer.hide_preview": "Hide Preview", - "composer.user_said_in": "Ο/Η %1 είπε στο %2:", - "composer.user_said": "Ο/Η %1 είπε:", - "composer.discard": "Είσαι σίγουρος/η πως θέλεις να πετάξεις αυτή την δημοσίευση;", + "composer.user_said_in": "%1 said in %2:", + "composer.user_said": "%1 said:", + "composer.discard": "Are you sure you wish to discard this post?", "composer.submit_and_lock": "Submit and Lock", "composer.toggle_dropdown": "Toggle Dropdown", "composer.uploading": "Uploading %1", diff --git a/public/language/el/notifications.json b/public/language/el/notifications.json index 08e3166f97..692813475f 100644 --- a/public/language/el/notifications.json +++ b/public/language/el/notifications.json @@ -1,15 +1,15 @@ { - "title": "Ειδοποιήσεις", - "no_notifs": "Δεν έχεις νέες ειδοποιήσεις;", + "title": "Notifications", + "no_notifs": "You have no new notifications", "see_all": "See all notifications", "mark_all_read": "Mark all notifications read", - "back_to_home": "Πίσω στο %1", - "outgoing_link": "Εξερχόμενος Σύνδεσμος", + "back_to_home": "Back to %1", + "outgoing_link": "Outgoing Link", "outgoing_link_message": "You are now leaving %1", - "continue_to": "Συνέχεια στο %1", - "return_to": "Επιστροφή στο %1", - "new_notification": "Νέα Ειδοποίηση", - "you_have_unread_notifications": "Έχεις μη αναγνωσμένες ειδοποιήσεις.", + "continue_to": "Continue to %1", + "return_to": "Return to %1", + "new_notification": "New Notification", + "you_have_unread_notifications": "You have unread notifications.", "all": "All", "topics": "Topics", "replies": "Replies", @@ -19,30 +19,30 @@ "new-flags": "New Flags", "my-flags": "Flags assigned to me", "bans": "Bans", - "new_message_from": "Νέο μήνυμα από τον/την %1", - "upvoted_your_post_in": "Ο/Η %1 υπερψήφισε την δημοσίευσή σου στο %2.", + "new_message_from": "New message from %1", + "upvoted_your_post_in": "%1 has upvoted your post in %2.", "upvoted_your_post_in_dual": "%1 and %2 have upvoted your post in %3.", "upvoted_your_post_in_multiple": "%1 and %2 others have upvoted your post in %3.", "moved_your_post": "%1 has moved your post to %2", "moved_your_topic": "%1 has moved %2", - "user_flagged_post_in": "Ο/Η %1 επεσήμανε μια δημοσίευσή σου στο %2", + "user_flagged_post_in": "%1 flagged a post in %2", "user_flagged_post_in_dual": "%1 and %2 flagged a post in %3", "user_flagged_post_in_multiple": "%1 and %2 others flagged a post in %3", "user_flagged_user": "%1 flagged a user profile (%2)", "user_flagged_user_dual": "%1 and %2 flagged a user profile (%3)", "user_flagged_user_multiple": "%1 and %2 others flagged a user profile (%3)", - "user_posted_to": "Ο/Η %1 έγραψε μια απάντηση στο: %2", + "user_posted_to": "%1 has posted a reply to: %2", "user_posted_to_dual": "%1 and %2 have posted replies to: %3", "user_posted_to_multiple": "%1 and %2 others have posted replies to: %3", "user_posted_topic": "%1 has posted a new topic: %2", - "user_started_following_you": "Ο/Η %1 σε ακολουθεί.", + "user_started_following_you": "%1 started following you.", "user_started_following_you_dual": "%1 and %2 started following you.", "user_started_following_you_multiple": "%1 and %2 others started following you.", "new_register": "%1 sent a registration request.", "new_register_multiple": "There are %1 registration requests awaiting review.", "flag_assigned_to_you": "Flag %1 has been assigned to you", - "email-confirmed": "Το Εmail Επιβεβαιώθηκε", - "email-confirmed-message": "Ευχαριστούμε που επιβεβαίωσες το email σου. Ο λογαριασμός σου είναι πλέον πλήρως ενεργοποιημένος.", - "email-confirm-error-message": "Υπήρξε κάποιο πρόβλημα με την επιβεβαίωση της διεύθυνσής email σου. Ίσως ο κώδικας να είναι άκυρος ή να έχει λήξει.", + "email-confirmed": "Email Confirmed", + "email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.", + "email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.", "email-confirm-sent": "Στάλθηκε email επιβεβαίωσης." } \ No newline at end of file diff --git a/public/language/el/reset_password.json b/public/language/el/reset_password.json index 7af6489001..4df4164ac3 100644 --- a/public/language/el/reset_password.json +++ b/public/language/el/reset_password.json @@ -9,8 +9,8 @@ "repeat_password": "Επιβεβαίωση Κωδικού", "enter_email": "Παρακαλώ γράψε την διεύθυνση email σου και θα σου στείλουμε ένα email με οδηγίες για το πως να επαναφέρεις τον λογαριασμό σου.", "enter_email_address": "Εισαγωγή Διεύθυνσης Email", - "password_reset_sent": "Η Επαναφορά Κωδικού Εστάλη", - "invalid_email": "Άκυρο Email / Το email δεν υπάρχει!", + "password_reset_sent": "Password Reset Sent", + "invalid_email": "Invalid Email / Email does not exist!", "password_too_short": "The password entered is too short, please pick a different password.", "passwords_do_not_match": "The two passwords you've entered do not match.", "password_expired": "Your password has expired, please choose a new password" From 2319af290444534538a4f54fba88e85ae80e50fb Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 14 Apr 2017 19:58:24 -0400 Subject: [PATCH 02/11] up persona --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9226588173..b808f60f8a 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "nodebb-plugin-spam-be-gone": "0.4.13", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "4.0.0", - "nodebb-theme-persona": "4.2.8", + "nodebb-theme-persona": "4.2.9", "nodebb-theme-vanilla": "5.2.1", "nodebb-widget-essentials": "2.0.13", "nodemailer": "2.6.4", From 9670d7d762d359699bda2ab5828ee4fac1c3e511 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 14 Apr 2017 20:03:39 -0400 Subject: [PATCH 03/11] up persona --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b808f60f8a..e846dfb8ce 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "nodebb-plugin-spam-be-gone": "0.4.13", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "4.0.0", - "nodebb-theme-persona": "4.2.9", + "nodebb-theme-persona": "4.2.10", "nodebb-theme-vanilla": "5.2.1", "nodebb-widget-essentials": "2.0.13", "nodemailer": "2.6.4", From ecfca21abe9b3330a75bf86f65668a74b46e6a53 Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Sat, 15 Apr 2017 00:50:12 -0600 Subject: [PATCH 04/11] Up composer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e846dfb8ce..2db62f41fd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "morgan": "^1.3.2", "mousetrap": "^1.5.3", "nconf": "~0.8.2", - "nodebb-plugin-composer-default": "4.4.4", + "nodebb-plugin-composer-default": "4.4.6", "nodebb-plugin-dbsearch": "1.0.5", "nodebb-plugin-emoji-extended": "1.1.1", "nodebb-plugin-emoji-one": "1.1.5", From 0fe10f5e866843485a71f05f32b99b72bd575c6a Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Sat, 15 Apr 2017 01:38:42 -0600 Subject: [PATCH 05/11] Escape topic titles at the source, deduplicate --- public/src/modules/translator.js | 6 ++++- src/categories/recentreplies.js | 4 +-- src/controllers/category.js | 3 --- src/controllers/topics.js | 4 +-- src/posts/summary.js | 13 +++++---- src/socket.io/admin/rooms.js | 2 +- src/socket.io/posts/tools.js | 2 +- src/socket.io/topics/tools.js | 2 +- src/topics/create.js | 2 +- src/topics/data.js | 46 +++++++++++++++++++++++++++++--- 10 files changed, 59 insertions(+), 25 deletions(-) diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index b0d1ad5cb8..2e9dcafb9c 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -50,6 +50,7 @@ /** * Construct a new Translator object * @param {string} language - Language code for this translator instance + * @exports translator.Translator */ function Translator(language) { var self = this; @@ -283,7 +284,7 @@ } var argsToTranslate = args.map(function (arg) { - return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s; + return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s.replace(/&/g, '&'); }).map(function (arg) { return self.translate(arg); }); @@ -443,6 +444,9 @@ return Translator; }()); + /** + * @exports translator + */ var adaptor = { /** * The Translator class diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js index 1908db45e6..595cba3f9e 100644 --- a/src/categories/recentreplies.js +++ b/src/categories/recentreplies.js @@ -3,7 +3,6 @@ var async = require('async'); var winston = require('winston'); -var validator = require('validator'); var _ = require('underscore'); var db = require('../database'); @@ -11,7 +10,6 @@ var posts = require('../posts'); var topics = require('../topics'); var privileges = require('../privileges'); var batch = require('../batch'); -var translator = require('../translator'); module.exports = function (Categories) { Categories.getRecentReplies = function (cid, uid, count, callback) { @@ -136,7 +134,7 @@ module.exports = function (Categories) { teaser.user.uid = undefined; teaser.topic = { slug: topicData[index].slug, - title: translator.escape(validator.escape(String(topicData[index].title))), + title: topicData[index].title, }; } }); diff --git a/src/controllers/category.js b/src/controllers/category.js index 602f158eeb..114fd8ba63 100644 --- a/src/controllers/category.js +++ b/src/controllers/category.js @@ -161,9 +161,6 @@ categoryController.get = function (req, res, callback) { return callback(err); } - categoryData.topics.forEach(function (topic) { - topic.title = translator.escape(topic.title); - }); categoryData.description = translator.escape(categoryData.description); categoryData.privileges = userPrivileges; categoryData.showSelect = categoryData.privileges.editable; diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 8f767ad36c..4fe1bf96d5 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -14,7 +14,6 @@ var plugins = require('../plugins'); var helpers = require('./helpers'); var pagination = require('../pagination'); var utils = require('../utils'); -var translator = require('../translator'); var topicsController = {}; @@ -130,14 +129,13 @@ topicsController.get = function (req, res, callback) { plugins.fireHook('filter:controllers.topic.get', { topicData: topicData, uid: req.uid }, next); }, function (data, next) { - data.topicData.title = translator.escape(data.topicData.title); var breadcrumbs = [ { text: data.topicData.category.name, url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug, }, { - text: translator.escape(data.topicData.title), + text: data.topicData.title, }, ]; diff --git a/src/posts/summary.js b/src/posts/summary.js index 0eaadaca94..065007dca8 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -5,12 +5,11 @@ var async = require('async'); var validator = require('validator'); var S = require('string'); -var db = require('../database'); +var topics = require('../topics'); var user = require('../user'); var plugins = require('../plugins'); var categories = require('../categories'); var utils = require('../utils'); -var translator = require('../translator'); module.exports = function (Posts) { Posts.getPostSummaryByPids = function (pids, uid, options, callback) { @@ -39,8 +38,8 @@ module.exports = function (Posts) { if (uids.indexOf(posts[i].uid) === -1) { uids.push(posts[i].uid); } - if (topicKeys.indexOf('topic:' + posts[i].tid) === -1) { - topicKeys.push('topic:' + posts[i].tid); + if (topicKeys.indexOf(posts[i].tid) === -1) { + topicKeys.push(posts[i].tid); } }); async.parallel({ @@ -111,15 +110,15 @@ module.exports = function (Posts) { }, callback); } - function getTopicAndCategories(topicKeys, callback) { - db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) { + function getTopicAndCategories(tids, callback) { + topics.getTopicsFields(tids, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) { if (err) { return callback(err); } var cids = topics.map(function (topic) { if (topic) { - topic.title = translator.escape(validator.escape(String(topic.title))); + topic.title = String(topic.title); topic.deleted = parseInt(topic.deleted, 10) === 1; } return topic && topic.cid; diff --git a/src/socket.io/admin/rooms.js b/src/socket.io/admin/rooms.js index 544bdc04da..f7a16bf85d 100644 --- a/src/socket.io/admin/rooms.js +++ b/src/socket.io/admin/rooms.js @@ -109,7 +109,7 @@ SocketRooms.getAll = function (socket, data, callback) { topTenTopics.forEach(function (topic, index) { totals.topics[topic.tid] = { value: topic.count || 0, - title: validator.escape(String(titles[index].title)), + title: String(titles[index].title), }; }); next(null, totals); diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js index ee393a42b9..8d7a91ae9a 100644 --- a/src/socket.io/posts/tools.js +++ b/src/socket.io/posts/tools.js @@ -169,7 +169,7 @@ module.exports = function (SocketPosts) { uid: socket.uid, pid: data.pid, ip: socket.ip, - title: validator.escape(String(title)), + title: String(title), }, next); }, ], callback); diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js index 74cdb68e7e..e08b31e6e4 100644 --- a/src/socket.io/topics/tools.js +++ b/src/socket.io/topics/tools.js @@ -114,7 +114,7 @@ module.exports = function (SocketTopics) { uid: socket.uid, ip: socket.ip, tid: tid, - title: validator.escape(String(title)), + title: String(title), }, next); }, ], callback); diff --git a/src/topics/create.js b/src/topics/create.js index 2c7f87741b..827465478b 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -323,7 +323,7 @@ module.exports = function (Topics) { postData.display_move_tools = true; postData.selfPost = false; postData.timestampISO = utils.toISOString(postData.timestamp); - postData.topic.title = validator.escape(String(postData.topic.title)); + postData.topic.title = String(postData.topic.title); next(null, postData); }, diff --git a/src/topics/data.js b/src/topics/data.js index 8df112dcbf..3a2a6e75d0 100644 --- a/src/topics/data.js +++ b/src/topics/data.js @@ -5,14 +5,43 @@ var validator = require('validator'); var db = require('../database'); var categories = require('../categories'); var utils = require('../utils'); +var translator = require('../translator'); + +function escapeTitle(topicData) { + if (!topicData) { + return; + } + if (topicData.title) { + topicData.title = translator.escape(validator.escape(topicData.title)); + } + if (topicData.titleRaw) { + topicData.titleRaw = translator.escape(topicData.titleRaw); + } +} module.exports = function (Topics) { Topics.getTopicField = function (tid, field, callback) { - db.getObjectField('topic:' + tid, field, callback); + db.getObjectField('topic:' + tid, field, function (err, value) { + if (err) { + return callback(err); + } + + if (field === 'title') { + value = translator.escape(validator.escape(value)); + } + callback(null, value); + }); }; Topics.getTopicFields = function (tid, fields, callback) { - db.getObjectFields('topic:' + tid, fields, callback); + db.getObjectFields('topic:' + tid, fields, function (err, topic) { + if (err) { + return callback(err); + } + + escapeTitle(topic); + callback(null, topic); + }); }; Topics.getTopicsFields = function (tids, fields, callback) { @@ -22,7 +51,14 @@ module.exports = function (Topics) { var keys = tids.map(function (tid) { return 'topic:' + tid; }); - db.getObjectsFields(keys, fields, callback); + db.getObjectsFields(keys, fields, function (err, topics) { + if (err) { + return callback(err); + } + + topics.forEach(escapeTitle); + callback(null, topics); + }); }; Topics.getTopicData = function (tid, callback) { @@ -57,8 +93,10 @@ module.exports = function (Topics) { if (!topic) { return; } + topic.titleRaw = topic.title; - topic.title = validator.escape(String(topic.title)); + topic.title = String(topic.title); + escapeTitle(topic); topic.timestampISO = utils.toISOString(topic.timestamp); topic.lastposttimeISO = utils.toISOString(topic.lastposttime); } From 0e615e7b091a930eb3bdb1ed75911ddb2f004020 Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Sat, 15 Apr 2017 09:22:15 +0000 Subject: [PATCH 06/11] Latest translations and fallbacks --- public/language/uk/email.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/language/uk/email.json b/public/language/uk/email.json index 48574768db..88deabc041 100644 --- a/public/language/uk/email.json +++ b/public/language/uk/email.json @@ -1,13 +1,13 @@ { - "password-reset-requested": "Отриман запит на відновлення паролю - %1!", + "password-reset-requested": "Отриманий запит на відновлення паролю - %1!", "welcome-to": "Ласкаво просимо до %1", "invite": "Запрошення від %1", "greeting_no_name": "Привіт", "greeting_with_name": "Привіт %1", "welcome.text1": "Дякуємо за реєстрацію з %1!", - "welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно верефікувати володіння е-мейлом, який ви вказали при реєстрації ", + "welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно перевірити, що вам належить електронна адреса, яку ви вказали при реєстрації ", "welcome.text3": "Адміністратор схвалив ваш запит на реєстрацію. Ви можете залогінитись, використовуючи свій пароль та назву аккаунту", - "welcome.cta": "Натисніть тут, щоб підтвердити вашу скриньку", + "welcome.cta": "Натисніть тут, щоб підтвердити вашу електронну адресу", "invitation.text1": "%1 запросив вас приєднатися до %2", "invitation.ctr": "Натисніть тут, щоб створити аккаунт", "reset.text1": "Ми отримали запит на відновлення вашого паролю, можливо тому, что ви його забули. Якщо це не потрібно - проігноруйте цей лист", From e382bca610191f4fc0880bf198e18357058b9548 Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Sat, 15 Apr 2017 04:22:28 -0600 Subject: [PATCH 07/11] Fix tests --- src/socket.io/admin/rooms.js | 2 +- src/socket.io/posts/tools.js | 1 - src/socket.io/topics/tools.js | 1 - src/topics/data.js | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/socket.io/admin/rooms.js b/src/socket.io/admin/rooms.js index f7a16bf85d..70b908d4dc 100644 --- a/src/socket.io/admin/rooms.js +++ b/src/socket.io/admin/rooms.js @@ -5,7 +5,7 @@ var async = require('async'); var os = require('os'); var nconf = require('nconf'); var winston = require('winston'); -var validator = require('validator'); + var topics = require('../../topics'); var pubsub = require('../../pubsub'); diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js index 8d7a91ae9a..c1ad05b119 100644 --- a/src/socket.io/posts/tools.js +++ b/src/socket.io/posts/tools.js @@ -1,7 +1,6 @@ 'use strict'; var async = require('async'); -var validator = require('validator'); var posts = require('../../posts'); var topics = require('../../topics'); diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js index e08b31e6e4..7302a5ad04 100644 --- a/src/socket.io/topics/tools.js +++ b/src/socket.io/topics/tools.js @@ -1,7 +1,6 @@ 'use strict'; var async = require('async'); -var validator = require('validator'); var topics = require('../../topics'); var events = require('../../events'); diff --git a/src/topics/data.js b/src/topics/data.js index 3a2a6e75d0..d0a6208632 100644 --- a/src/topics/data.js +++ b/src/topics/data.js @@ -12,7 +12,7 @@ function escapeTitle(topicData) { return; } if (topicData.title) { - topicData.title = translator.escape(validator.escape(topicData.title)); + topicData.title = translator.escape(validator.escape(topicData.title.toString())); } if (topicData.titleRaw) { topicData.titleRaw = translator.escape(topicData.titleRaw); @@ -27,7 +27,7 @@ module.exports = function (Topics) { } if (field === 'title') { - value = translator.escape(validator.escape(value)); + value = translator.escape(validator.escape(String(value))); } callback(null, value); }); From baa2a59f4c2adbe4d3aed525ba9b5b53465a819a Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Fri, 14 Apr 2017 00:13:25 -0600 Subject: [PATCH 08/11] Fix ace editor not working --- public/src/admin/admin.js | 6 ++++++ public/src/admin/appearance/customise.js | 1 - public/src/admin/settings/email.js | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js index 7ec41a553b..0b6867b81c 100644 --- a/public/src/admin/admin.js +++ b/public/src/admin/admin.js @@ -231,4 +231,10 @@ }); }); } + + // tell ace to use the right paths when requiring modules + require(['ace/ace'], function (ace) { + ace.config.set('packaged', true); + ace.config.set('basePath', config.relative_path + '/assets/src/modules/ace/'); + }); }()); diff --git a/public/src/admin/appearance/customise.js b/public/src/admin/appearance/customise.js index a8fc5282cd..268d8480af 100644 --- a/public/src/admin/appearance/customise.js +++ b/public/src/admin/appearance/customise.js @@ -1,6 +1,5 @@ 'use strict'; - define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Settings, ace) { var Customise = {}; diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js index ca454ab1ba..d25fa05c30 100644 --- a/public/src/admin/settings/email.js +++ b/public/src/admin/settings/email.js @@ -1,7 +1,7 @@ 'use strict'; -define('admin/settings/email', ['admin/settings', 'ace/ace'], function (ace) { +define('admin/settings/email', ['ace/ace', 'admin/settings'], function (ace) { var module = {}; var emailEditor; From 6e5a79842f302e3db0677446241ea9d830d5c72d Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Fri, 14 Apr 2017 19:06:53 -0600 Subject: [PATCH 09/11] Fix #5595 --- install/data/navigation.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/install/data/navigation.json b/install/data/navigation.json index 0ec72805de..8c7965dc7e 100644 --- a/install/data/navigation.json +++ b/install/data/navigation.json @@ -1,71 +1,71 @@ [ { "route": "/categories", - "title": "\\[\\[global:header.categories\\]\\]", + "title": "[[global:header.categories]]", "enabled": true, "iconClass": "fa-list", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.categories\\]\\]" + "text": "[[global:header.categories]]" }, { "id": "unread-count", "route": "/unread", - "title": "\\[\\[global:header.unread\\]\\]", + "title": "[[global:header.unread]]", "enabled": true, "iconClass": "fa-inbox", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.unread\\]\\]", + "text": "[[global:header.unread]]", "properties": { "loggedIn": true } }, { "route": "/recent", - "title": "\\[\\[global:header.recent\\]\\]", + "title": "[[global:header.recent]]", "enabled": true, "iconClass": "fa-clock-o", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.recent\\]\\]" + "text": "[[global:header.recent]]" }, { "route": "/tags", - "title": "\\[\\[global:header.tags\\]\\]", + "title": "[[global:header.tags]]", "enabled": true, "iconClass": "fa-tags", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.tags\\]\\]" + "text": "[[global:header.tags]]" }, { "route": "/popular", - "title": "\\[\\[global:header.popular\\]\\]", + "title": "[[global:header.popular]]", "enabled": true, "iconClass": "fa-fire", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.popular\\]\\]" + "text": "[[global:header.popular]]" }, { "route": "/users", - "title": "\\[\\[global:header.users\\]\\]", + "title": "[[global:header.users]]", "enabled": true, "iconClass": "fa-user", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.users\\]\\]" + "text": "[[global:header.users]]" }, { "route": "/groups", - "title": "\\[\\[global:header.groups\\]\\]", + "title": "[[global:header.groups]]", "enabled": true, "iconClass": "fa-group", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.groups\\]\\]" + "text": "[[global:header.groups]]" }, { "route": "/admin", - "title": "\\[\\[global:header.admin\\]\\]", + "title": "[[global:header.admin]]", "enabled": true, "iconClass": "fa-cogs", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.admin\\]\\]", + "text": "[[global:header.admin]]", "properties": { "targetBlank": false, "adminOnly": true @@ -73,11 +73,11 @@ }, { "route": "/search", - "title": "\\[\\[global:header.search\\]\\]", + "title": "[[global:header.search]]", "enabled": true, "iconClass": "fa-search", "textClass": "visible-xs-inline", - "text": "\\[\\[global:header.search\\]\\]", + "text": "[[global:header.search]]", "properties": { "searchInstalled": true } From 37c421818484e1b582ce8ff1054bf4cbd0b98aca Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Sat, 15 Apr 2017 15:42:42 -0600 Subject: [PATCH 10/11] Fix error if `./nodebb build` isn't called before tests --- src/languages.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/languages.js b/src/languages.js index 0769656519..c4c3d5ae0e 100644 --- a/src/languages.js +++ b/src/languages.js @@ -31,6 +31,9 @@ Languages.list = function (callback) { var languages = []; fs.readdir(languagesPath, function (err, files) { + if (err && err.code === 'ENOENT') { + return callback(null, []); + } if (err) { return callback(err); } From 9f8d80e3a48751d6b775d38d4a2d6555147f8d8b Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 16 Apr 2017 14:22:40 -0400 Subject: [PATCH 11/11] closes #5600 --- src/database/mongo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index 91b41306f1..ae2ff77856 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -116,9 +116,9 @@ var meta = require('../meta'); var sessionStore; - var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0); - var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0); - var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 days + var ttlDays = 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0); + var ttlSeconds = (parseInt(meta.config.loginSeconds, 10) || 0); + var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days in seconds if (nconf.get('redis')) { sessionStore = require('connect-redis')(session);