From 3545331a89062c2fe0592d3a79acb042b29363cf Mon Sep 17 00:00:00 2001 From: NodeBB Misty Date: Sun, 28 Aug 2016 09:02:37 -0400 Subject: [PATCH 01/54] Latest translations and fallbacks --- public/language/it/global.json | 2 +- public/language/it/topic.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/language/it/global.json b/public/language/it/global.json index 28da5ad9c8..9eac023108 100644 --- a/public/language/it/global.json +++ b/public/language/it/global.json @@ -10,7 +10,7 @@ "500.title": "Errore interno.", "500.message": "Oops! Qualcosa non funziona come si deve!", "400.title": "Bad Request.", - "400.message": "It looks like this link is malformed, please double-check and try again. Otherwise, return to the home page.", + "400.message": "Sembra che questo link sia stato mal formulato, per favore ricontrolla e riprova. Altrimenti ritorna alla home page.", "register": "Registrazione", "login": "Login", "please_log_in": "Per favore Accedi", diff --git a/public/language/it/topic.json b/public/language/it/topic.json index f44a429712..59a99d3c71 100644 --- a/public/language/it/topic.json +++ b/public/language/it/topic.json @@ -34,7 +34,7 @@ "deleted_message": "Questa discussione è stata cancellata. Solo gli utenti con diritti di gestione possono vederla.", "following_topic.message": "Da ora riceverai notifiche quando qualcuno posterà in questa discussione.", "not_following_topic.message": "Vedrai questa discussione nella lista delle discussioni non lette, ma non riceverai notifiche quando qualcuno risponde a questa discussione.", - "ignoring_topic.message": "You will no longer see this topic in the unread topics list. You will be notified when you are mentioned or your post is up voted.", + "ignoring_topic.message": "Non vedrai più questa discussione tra la lista dei non letti. Sarai notificato in caso qualcuno ti menzioni o se un tuo post viene votato positivamente.", "login_to_subscribe": "Si prega di accedere o registrarsi per potersi iscrivere a questa discussione.", "markAsUnreadForAll.success": "Discussione segnata come non letta per tutti.", "mark_unread": "Segna come non letto", From 6d34bb465755b8d88ce4357ec2c70f44265190b2 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 29 Aug 2016 12:43:32 +0300 Subject: [PATCH 02/54] closes #2166 --- public/language/en_GB/global.json | 3 +- public/language/en_GB/user.json | 4 ++ public/src/client/account/settings.js | 15 +++++++- public/src/modules/sounds.js | 12 +++--- src/controllers/accounts/settings.js | 12 +++++- src/controllers/api.js | 31 ++++++--------- src/meta/sounds.js | 54 ++++++++++++++++----------- src/socket.io/modules.js | 4 +- src/user/settings.js | 7 ++-- src/views/admin/settings/user.tpl | 7 ---- 10 files changed, 87 insertions(+), 62 deletions(-) diff --git a/public/language/en_GB/global.json b/public/language/en_GB/global.json index 66ea4af420..e2785de2f5 100644 --- a/public/language/en_GB/global.json +++ b/public/language/en_GB/global.json @@ -121,5 +121,6 @@ "allowed-file-types": "Allowed file types are %1", "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", - "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect.", + "play": "Play" } diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index b1cb065de5..5863d4d67c 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -98,6 +98,10 @@ "posts_per_page": "Posts per Page", "notification_sounds" : "Play a sound when you receive a notification", + "notifications_and_sounds": "Notifications & Sounds", + "incoming-message-sound": "Incoming message sound", + "outgoing-message-sound": "Outgoing message sound", + "notification-sound": "Notification sound", "browsing": "Browsing Settings", "open_links_in_new_tab": "Open outgoing links in new tab", diff --git a/public/src/client/account/settings.js b/public/src/client/account/settings.js index 1060492bf0..cc9aaf0439 100644 --- a/public/src/client/account/settings.js +++ b/public/src/client/account/settings.js @@ -2,7 +2,7 @@ /*global define, socket, app, ajaxify, config*/ -define('forum/account/settings', ['forum/account/header', 'components'], function(header, components) { +define('forum/account/settings', ['forum/account/header', 'components', 'sounds'], function(header, components, sounds) { var AccountSettings = {}; AccountSettings.init = function() { @@ -33,6 +33,13 @@ define('forum/account/settings', ['forum/account/header', 'components'], functio $('[data-property="homePageRoute"]').on('change', toggleCustomRoute); + $('.account').find('button[data-action="play"]').on('click', function(e) { + e.preventDefault(); + + var fileName = $(this).parent().parent().find('select').val(); + sounds.playFile(fileName); + }); + toggleCustomRoute(); components.get('user/sessions').find('.timeago').timeago(); @@ -77,10 +84,14 @@ define('forum/account/settings', ['forum/account/header', 'components'], functio if (key === 'userLang' && config.userLang !== newSettings.userLang) { requireReload = true; } - config[key] = newSettings[key]; + if (config.hasOwnProperty(key)) { + config[key] = newSettings[key]; + } } } + sounds.reloadMapping(); + if (requireReload && parseInt(app.user.uid, 10) === parseInt(ajaxify.data.theirid, 10)) { app.alert({ id: 'setting-change', diff --git a/public/src/modules/sounds.js b/public/src/modules/sounds.js index 052e804f6e..a9a1840fd4 100644 --- a/public/src/modules/sounds.js +++ b/public/src/modules/sounds.js @@ -9,13 +9,17 @@ define('sounds', ['buzz'], function(buzz) { var files; socket.on('event:sounds.reloadMapping', function() { + Sounds.reloadMapping(); + }); + + Sounds.reloadMapping = function() { socket.emit('modules.sounds.getMapping', function(err, mapping) { if (err) { - return app.alertError('[sounds] Could not load sound mapping!'); + return app.alertError(err.message); } eventSoundMapping = mapping; }); - }); + } function loadData(callback) { socket.emit('modules.sounds.getData', function(err, data) { @@ -55,10 +59,6 @@ define('sounds', ['buzz'], function(buzz) { Sounds.playFile(eventSoundMapping[name]); } - if (!config.notificationSounds) { - return; - } - if (!eventSoundMapping) { return loadData(play); } diff --git a/src/controllers/accounts/settings.js b/src/controllers/accounts/settings.js index 3b169bf83c..11ea490d6f 100644 --- a/src/controllers/accounts/settings.js +++ b/src/controllers/accounts/settings.js @@ -3,7 +3,6 @@ var async = require('async'); var user = require('../../user'); -var groups = require('../../groups'); var languages = require('../../languages'); var meta = require('../../meta'); var plugins = require('../../plugins'); @@ -37,6 +36,9 @@ settingsController.get = function(req, res, callback) { }, homePageRoutes: function(next) { getHomePageRoutes(next); + }, + sounds: function(next) { + meta.sounds.getFiles(next); } }, next); }, @@ -44,6 +46,14 @@ settingsController.get = function(req, res, callback) { userData.settings = results.settings; userData.languages = results.languages; userData.homePageRoutes = results.homePageRoutes; + + var soundSettings = ['notificationSound', 'incomingChatSound', 'outgoingChatSound']; + soundSettings.forEach(function(setting) { + userData[setting] = Object.keys(results.sounds).map(function(name) { + return {name: name, selected: name === userData.settings[setting]}; + }); + }); + plugins.fireHook('filter:user.customSettings', {settings: results.settings, customSettings: [], uid: req.uid}, next); }, function(data, next) { diff --git a/src/controllers/api.js b/src/controllers/api.js index 968a0d86a6..42cc74e7e7 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -12,7 +12,6 @@ var categories = require('../categories'); var privileges = require('../privileges'); var plugins = require('../plugins'); var widgets = require('../widgets'); -var helpers = require('../controllers/helpers'); var accountHelpers = require('../controllers/accounts/helpers'); var apiController = {}; @@ -68,25 +67,19 @@ apiController.getConfig = function(req, res, next) { if (!req.user) { return next(null, config); } - user.getSettings(req.uid, function(err, settings) { - if (err) { - return next(err); - } - config.usePagination = settings.usePagination; - config.topicsPerPage = settings.topicsPerPage; - config.postsPerPage = settings.postsPerPage; - config.notificationSounds = settings.notificationSounds; - config.userLang = (req.query.lang ? validator.escape(String(req.query.lang)) : null) || settings.userLang || config.defaultLang; - config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab; - config.topicPostSort = settings.topicPostSort || config.topicPostSort; - config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort; - config.topicSearchEnabled = settings.topicSearchEnabled || false; - config.delayImageLoading = settings.delayImageLoading !== undefined ? settings.delayImageLoading : true; - config.bootswatchSkin = settings.bootswatchSkin || config.bootswatchSkin; - next(null, config); - }); + user.getSettings(req.uid, next); }, - function (config, next) { + function (settings, next) { + config.usePagination = settings.usePagination; + config.topicsPerPage = settings.topicsPerPage; + config.postsPerPage = settings.postsPerPage; + config.userLang = (req.query.lang ? validator.escape(String(req.query.lang)) : null) || settings.userLang || config.defaultLang; + config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab; + config.topicPostSort = settings.topicPostSort || config.topicPostSort; + config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort; + config.topicSearchEnabled = settings.topicSearchEnabled || false; + config.delayImageLoading = settings.delayImageLoading !== undefined ? settings.delayImageLoading : true; + config.bootswatchSkin = settings.bootswatchSkin || config.bootswatchSkin; plugins.fireHook('filter:config.get', config, next); } ], function(err, config) { diff --git a/src/meta/sounds.js b/src/meta/sounds.js index c802458b14..c413def9e3 100644 --- a/src/meta/sounds.js +++ b/src/meta/sounds.js @@ -1,15 +1,16 @@ 'use strict'; -var path = require('path'), - fs = require('fs'), - nconf = require('nconf'), - winston = require('winston'), - rimraf = require('rimraf'), - mkdirp = require('mkdirp'), - async = require('async'), +var path = require('path'); +var fs = require('fs'); +var nconf = require('nconf'); +var winston = require('winston'); +var rimraf = require('rimraf'); +var mkdirp = require('mkdirp'); +var async = require('async'); - plugins = require('../plugins'), - db = require('../database'); +var user = require('../user'); +var plugins = require('../plugins'); +var db = require('../database'); module.exports = function(Meta) { @@ -58,20 +59,31 @@ module.exports = function(Meta) { }); }; - Meta.sounds.getMapping = function(callback) { - db.getObject('settings:sounds', function(err, sounds) { - if (err || !sounds) { - // Send default sounds - var defaults = { - 'notification': 'notification.mp3', - 'chat-incoming': 'waterdrop-high.mp3', - 'chat-outgoing': undefined - }; - - return callback(null, defaults); + Meta.sounds.getMapping = function(uid, callback) { + async.parallel({ + defaultMapping: function(next) { + db.getObject('settings:sounds', next); + }, + userSettings: function(next) { + user.getSettings(uid, next); } + }, function(err, results) { + if (err) { + return callback(err); + } + var userSettings = results.userSettings; + var defaultMapping = results.defaultMapping || {}; + var soundMapping = {}; + soundMapping.notification = (userSettings.notificationSound || userSettings.notificationSound === '') ? + userSettings.notificationSound : defaultMapping.notification || 'notification.mp3'; - callback(null, sounds); + soundMapping['chat-incoming'] = (userSettings.incomingChatSound || userSettings.incomingChatSound === '') ? + userSettings.incomingChatSound : defaultMapping['chat-incoming'] || 'waterdrop-high.mp3'; + + soundMapping['chat-outgoing'] = (userSettings.outgoingChatSound || userSettings.outgoingChatSound === '') ? + userSettings.outgoingChatSound : defaultMapping['chat-outgoing'] || undefined; + + callback(null, soundMapping); }); }; diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index 568d971b65..954d407d5f 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -313,12 +313,12 @@ SocketModules.sounds.getSounds = function(socket, data, callback) { }; SocketModules.sounds.getMapping = function(socket, data, callback) { - meta.sounds.getMapping(callback); + meta.sounds.getMapping(socket.uid, callback); }; SocketModules.sounds.getData = function(socket, data, callback) { async.parallel({ - mapping: async.apply(meta.sounds.getMapping), + mapping: async.apply(meta.sounds.getMapping, socket.uid), files: async.apply(meta.sounds.getFiles) }, callback); }; diff --git a/src/user/settings.js b/src/user/settings.js index 55bf2b14ff..f4d9b37986 100644 --- a/src/user/settings.js +++ b/src/user/settings.js @@ -65,7 +65,6 @@ module.exports = function(User) { settings.usePagination = parseInt(getSetting(settings, 'usePagination', 0), 10) === 1; settings.topicsPerPage = Math.min(settings.topicsPerPage ? parseInt(settings.topicsPerPage, 10) : defaultTopicsPerPage, defaultTopicsPerPage); settings.postsPerPage = Math.min(settings.postsPerPage ? parseInt(settings.postsPerPage, 10) : defaultPostsPerPage, defaultPostsPerPage); - settings.notificationSounds = parseInt(getSetting(settings, 'notificationSounds', 0), 10) === 1; settings.userLang = settings.userLang || meta.config.defaultLang || 'en_GB'; settings.topicPostSort = getSetting(settings, 'topicPostSort', 'oldest_to_newest'); settings.categoryTopicSort = getSetting(settings, 'categoryTopicSort', 'newest_to_oldest'); @@ -113,7 +112,6 @@ module.exports = function(User) { usePagination: data.usePagination, topicsPerPage: Math.min(data.topicsPerPage, parseInt(meta.config.topicsPerPage, 10) || 20), postsPerPage: Math.min(data.postsPerPage, parseInt(meta.config.postsPerPage, 10) || 20), - notificationSounds: data.notificationSounds, userLang: data.userLang || meta.config.defaultLang, followTopicsOnCreate: data.followTopicsOnCreate, followTopicsOnReply: data.followTopicsOnReply, @@ -123,7 +121,10 @@ module.exports = function(User) { topicSearchEnabled: data.topicSearchEnabled, delayImageLoading: data.delayImageLoading, homePageRoute : ((data.homePageRoute === 'custom' ? data.homePageCustom : data.homePageRoute) || '').replace(/^\//, ''), - scrollToMyPost: data.scrollToMyPost + scrollToMyPost: data.scrollToMyPost, + notificationSound: data.notificationSound, + incomingChatSound: data.incomingChatSound, + outgoingChatSound: data.outgoingChatSound }; if (data.bootswatchSkin) { diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tpl index 575a4a07f9..aecdd1a0cb 100644 --- a/src/views/admin/settings/user.tpl +++ b/src/views/admin/settings/user.tpl @@ -261,13 +261,6 @@ -
- -
- From 843dc61e41a20b8b658a3464ea5156cb2a814219 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 29 Aug 2016 15:51:46 +0300 Subject: [PATCH 03/54] closes #4990 --- public/src/client/topic/postTools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 85a8986a4b..86fe03ce03 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -59,7 +59,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator postEl.find('[component="post/restore"]').toggleClass('hidden', !isDeleted); postEl.find('[component="post/purge"]').toggleClass('hidden', !isDeleted); - postEl.find('.dropdown-menu').html(''); + postEl.find('[component="post/tools"] .dropdown-menu').html(''); }; PostTools.updatePostCount = function(postCount) { From 06d74c4c3fe1a960fb9fb77ca69ac390e6f2d526 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 29 Aug 2016 15:52:01 +0300 Subject: [PATCH 04/54] up themes --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e819e4c56d..5db6ddf4aa 100644 --- a/package.json +++ b/package.json @@ -58,8 +58,8 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.13", - "nodebb-theme-persona": "4.1.35", - "nodebb-theme-vanilla": "5.1.20", + "nodebb-theme-persona": "4.1.36", + "nodebb-theme-vanilla": "5.1.21", "nodebb-widget-essentials": "2.0.10", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", From a9b68606a1ed831829e0d8c510e069d95149dc90 Mon Sep 17 00:00:00 2001 From: NodeBB Misty Date: Mon, 29 Aug 2016 09:02:37 -0400 Subject: [PATCH 05/54] Latest translations and fallbacks --- public/language/ar/global.json | 3 ++- public/language/bg/global.json | 3 ++- public/language/bn/global.json | 3 ++- public/language/cs/global.json | 3 ++- public/language/da/global.json | 3 ++- public/language/de/global.json | 3 ++- public/language/el/global.json | 3 ++- public/language/en@pirate/global.json | 3 ++- public/language/en_US/global.json | 3 ++- public/language/es/global.json | 3 ++- public/language/et/global.json | 3 ++- public/language/fa_IR/global.json | 9 +++++---- public/language/fi/global.json | 3 ++- public/language/fr/global.json | 3 ++- public/language/gl/global.json | 3 ++- public/language/he/global.json | 3 ++- public/language/hu/global.json | 3 ++- public/language/id/global.json | 3 ++- public/language/it/email.json | 2 +- public/language/it/global.json | 3 ++- public/language/it/user.json | 2 +- public/language/ja/global.json | 3 ++- public/language/ko/global.json | 3 ++- public/language/lt/global.json | 3 ++- public/language/ms/global.json | 3 ++- public/language/nb/global.json | 3 ++- public/language/nl/global.json | 3 ++- public/language/pl/global.json | 3 ++- public/language/pt_BR/global.json | 3 ++- public/language/ro/global.json | 3 ++- public/language/ru/global.json | 3 ++- public/language/rw/global.json | 3 ++- public/language/sc/global.json | 3 ++- public/language/sk/global.json | 3 ++- public/language/sl/global.json | 3 ++- public/language/sr/global.json | 3 ++- public/language/sv/global.json | 3 ++- public/language/th/global.json | 3 ++- public/language/tr/global.json | 5 +++-- public/language/vi/global.json | 3 ++- public/language/zh_CN/global.json | 3 ++- public/language/zh_TW/global.json | 3 ++- 42 files changed, 86 insertions(+), 46 deletions(-) diff --git a/public/language/ar/global.json b/public/language/ar/global.json index 2e4d39d113..fc94028a36 100644 --- a/public/language/ar/global.json +++ b/public/language/ar/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/bg/global.json b/public/language/bg/global.json index 6a68bfcec3..d4ffed8334 100644 --- a/public/language/bg/global.json +++ b/public/language/bg/global.json @@ -95,5 +95,6 @@ "upload_file": "Качване на файл", "upload": "Качване", "allowed-file-types": "Разрешените файлови типове са: %1", - "unsaved-changes": "Имате незапазени промени. Наистина ли искате да напуснете тази страница?" + "unsaved-changes": "Имате незапазени промени. Наистина ли искате да напуснете тази страница?", + "reconnecting-message": "Изглежда връзката Ви към %1 беше прекъсната. Моля, изчакайте докато се опитаме да Ви свържем отново." } \ No newline at end of file diff --git a/public/language/bn/global.json b/public/language/bn/global.json index f678961fcd..545020267d 100644 --- a/public/language/bn/global.json +++ b/public/language/bn/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/cs/global.json b/public/language/cs/global.json index 80a7ee4825..e822b289c3 100644 --- a/public/language/cs/global.json +++ b/public/language/cs/global.json @@ -95,5 +95,6 @@ "upload_file": "Nahrár soubor", "upload": "Nahrát", "allowed-file-types": "Povolené typy souborů jsou %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/da/global.json b/public/language/da/global.json index 5f6d693e1f..5ef9da2842 100644 --- a/public/language/da/global.json +++ b/public/language/da/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload fil", "upload": "Upload", "allowed-file-types": "Tilladte filtyper er %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/de/global.json b/public/language/de/global.json index 775e81cbfa..2793fc58cf 100644 --- a/public/language/de/global.json +++ b/public/language/de/global.json @@ -95,5 +95,6 @@ "upload_file": "Datei hochladen", "upload": "Hochladen", "allowed-file-types": "Erlaubte Dateitypen sind %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/el/global.json b/public/language/el/global.json index 1c475bdf03..34df3b45bf 100644 --- a/public/language/el/global.json +++ b/public/language/el/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/en@pirate/global.json b/public/language/en@pirate/global.json index 9bb8beecd3..aa50d9d08a 100644 --- a/public/language/en@pirate/global.json +++ b/public/language/en@pirate/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/en_US/global.json b/public/language/en_US/global.json index 004929c8a8..383516d05c 100644 --- a/public/language/en_US/global.json +++ b/public/language/en_US/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/es/global.json b/public/language/es/global.json index d75547742a..2162a64ee7 100644 --- a/public/language/es/global.json +++ b/public/language/es/global.json @@ -95,5 +95,6 @@ "upload_file": "Subir archivo", "upload": "Subir", "allowed-file-types": "Los tipos de archivos permitidos son: %1", - "unsaved-changes": "Tienes cambios sin guardar. Seguro que quieres salir?" + "unsaved-changes": "Tienes cambios sin guardar. Seguro que quieres salir?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/et/global.json b/public/language/et/global.json index 339239f4bb..67ae319e61 100644 --- a/public/language/et/global.json +++ b/public/language/et/global.json @@ -95,5 +95,6 @@ "upload_file": "Lae fail üles", "upload": "Lae üles", "allowed-file-types": "Lubatud faili formaadid on %1", - "unsaved-changes": "Sul on salvestamata muudatusi. Oled kindel, et soovid lahkuda?" + "unsaved-changes": "Sul on salvestamata muudatusi. Oled kindel, et soovid lahkuda?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/fa_IR/global.json b/public/language/fa_IR/global.json index a8da7a5cd6..7c7e92772d 100644 --- a/public/language/fa_IR/global.json +++ b/public/language/fa_IR/global.json @@ -7,10 +7,10 @@ "403.login": "شاید باید وارد شوید؟", "404.title": "یافت نشد", "404.message": "به نظر میاید شما به صفحه ای برخورد کرده اید که وجود ندارد. بازگشت به صفحه ی خانه", - "500.title": "Internal Error.", + "500.title": "خطای داخلی.", "500.message": "اوه! گویا اشتباهی رخ داده!", - "400.title": "Bad Request.", - "400.message": "It looks like this link is malformed, please double-check and try again. Otherwise, return to the home page.", + "400.title": "درخواست بد.", + "400.message": "به نظر می‌رسد که این پیوند مشکل دارد، لطفا دوباره بررسی کنید که این پیوند صحیح است و دوباره تلاش کنید، در غیر این‌صورت به صفحه اصلی بازگردید.", "register": "نام‌نویسی", "login": "درون آمدن", "please_log_in": "لطفا به درون بیایید", @@ -95,5 +95,6 @@ "upload_file": "بارگذاری فایل", "upload": "بارگذاری", "allowed-file-types": "فایل قابل قبول اینها هستند %1", - "unsaved-changes": "تغییرات شما ذخیره نشده. شما مطمئن هستید که میخواهید از اینجا دور شوید؟" + "unsaved-changes": "تغییرات شما ذخیره نشده. شما مطمئن هستید که میخواهید از اینجا دور شوید؟", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/fi/global.json b/public/language/fi/global.json index a2fd93afde..434aece0f3 100644 --- a/public/language/fi/global.json +++ b/public/language/fi/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/fr/global.json b/public/language/fr/global.json index ba4388b9fe..a37d6fa925 100644 --- a/public/language/fr/global.json +++ b/public/language/fr/global.json @@ -95,5 +95,6 @@ "upload_file": "Envoyer un fichier", "upload": "Envoyer", "allowed-file-types": "Les types de fichiers autorisés sont : %1", - "unsaved-changes": "Vous avez des modifications non sauvegardées. Êtes-vous sûr de vouloir naviguer tout de même ?" + "unsaved-changes": "Vous avez des modifications non sauvegardées. Êtes-vous sûr de vouloir naviguer tout de même ?", + "reconnecting-message": "Il semble que votre connexion ait été perdue, veuillez patienter pendant que nous vous re-connectons." } \ No newline at end of file diff --git a/public/language/gl/global.json b/public/language/gl/global.json index c00aec98d1..0f8663d96f 100644 --- a/public/language/gl/global.json +++ b/public/language/gl/global.json @@ -95,5 +95,6 @@ "upload_file": "Subir arquivo ", "upload": "Subir", "allowed-file-types": "Os tipos de arquivos permitidos son: %1", - "unsaved-changes": "Non gardaches tódolos cambios. Queres continuar e saír da páxina?" + "unsaved-changes": "Non gardaches tódolos cambios. Queres continuar e saír da páxina?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/he/global.json b/public/language/he/global.json index ea6d32468d..e6b0d8e31b 100644 --- a/public/language/he/global.json +++ b/public/language/he/global.json @@ -95,5 +95,6 @@ "upload_file": "העלה קובץ", "upload": "העלה", "allowed-file-types": "פורמטי הקבצים המורשים הם %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/hu/global.json b/public/language/hu/global.json index e7111389bc..1aae7c960b 100644 --- a/public/language/hu/global.json +++ b/public/language/hu/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/id/global.json b/public/language/id/global.json index 6a005844c4..313a120729 100644 --- a/public/language/id/global.json +++ b/public/language/id/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/it/email.json b/public/language/it/email.json index bd1ddb45d7..f30f93b9f5 100644 --- a/public/language/it/email.json +++ b/public/language/it/email.json @@ -24,7 +24,7 @@ "digest.day": "giorno", "digest.week": "settimana", "digest.month": "mese", - "digest.subject": "Digest for %1", + "digest.subject": "Sommario per %1", "notif.chat.subject": "Nuovo messaggio in chat da %1", "notif.chat.cta": "Clicca qui per continuare la conversazione", "notif.chat.unsub.info": "Questa notifica di chat ti è stata inviata perché l'hai scelta nelle impostazioni.", diff --git a/public/language/it/global.json b/public/language/it/global.json index 9eac023108..f35e9b5791 100644 --- a/public/language/it/global.json +++ b/public/language/it/global.json @@ -95,5 +95,6 @@ "upload_file": "Carica file", "upload": "Carica", "allowed-file-types": "Le estensioni permesse dei file sono %1", - "unsaved-changes": "Hai delle modifiche non salvate. Sei sicuro che vuoi lasciare la pagina?" + "unsaved-changes": "Hai delle modifiche non salvate. Sei sicuro che vuoi lasciare la pagina?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/it/user.json b/public/language/it/user.json index c2f3fe9995..303a2cbe6b 100644 --- a/public/language/it/user.json +++ b/public/language/it/user.json @@ -93,7 +93,7 @@ "open_links_in_new_tab": "Apri i link web in una nuova pagina", "enable_topic_searching": "Abilita la ricerca negli argomenti", "topic_search_help": "Se abilitata, la ricerca negli argomenti ignorerà il comportamento predefinito del browser per consentirti di cercare all'interno delle discussioni, anziché soltanto nel contenuto visibile a schermo", - "delay_image_loading": "Delay Image Loading", + "delay_image_loading": "Ritarda il caricamento delle immagini", "image_load_delay_help": "Se selezionato, le immagini nelle discussioni non saranno caricate finché non sono visibili nello schermo", "scroll_to_my_post": "Dopo aver postato una risposta, mostra il nuovo post", "follow_topics_you_reply_to": "Segui le discussioni a cui rispondi", diff --git a/public/language/ja/global.json b/public/language/ja/global.json index 038f6333f0..107ae13ee7 100644 --- a/public/language/ja/global.json +++ b/public/language/ja/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/ko/global.json b/public/language/ko/global.json index 94905f6ffc..6e9b7b3a93 100644 --- a/public/language/ko/global.json +++ b/public/language/ko/global.json @@ -95,5 +95,6 @@ "upload_file": "파일 업로드", "upload": "업로드", "allowed-file-types": "사용가능한 파일 유형: %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/lt/global.json b/public/language/lt/global.json index 6f5399905d..1ffeb7040a 100644 --- a/public/language/lt/global.json +++ b/public/language/lt/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/ms/global.json b/public/language/ms/global.json index dc65efdc18..40d6209ba9 100644 --- a/public/language/ms/global.json +++ b/public/language/ms/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/nb/global.json b/public/language/nb/global.json index 10d96d584e..020fe6aa62 100644 --- a/public/language/nb/global.json +++ b/public/language/nb/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/nl/global.json b/public/language/nl/global.json index 59c43d4893..bf94e340b2 100644 --- a/public/language/nl/global.json +++ b/public/language/nl/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload bestand", "upload": "Upload", "allowed-file-types": "Toegestane bestandstypen zijn %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/pl/global.json b/public/language/pl/global.json index 4054a256fe..0a88d05532 100644 --- a/public/language/pl/global.json +++ b/public/language/pl/global.json @@ -95,5 +95,6 @@ "upload_file": "Załaduj plik", "upload": "Załaduj", "allowed-file-types": "Dozwolone typy plików %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/pt_BR/global.json b/public/language/pt_BR/global.json index 27e5782a3d..71543c8896 100644 --- a/public/language/pt_BR/global.json +++ b/public/language/pt_BR/global.json @@ -95,5 +95,6 @@ "upload_file": "Fazer upload de arquivo", "upload": "Upload", "allowed-file-types": "Os tipos de arquivo permitidos são %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/ro/global.json b/public/language/ro/global.json index 7a843384a0..c634e3a1c8 100644 --- a/public/language/ro/global.json +++ b/public/language/ro/global.json @@ -95,5 +95,6 @@ "upload_file": "Încărcați fișierul", "upload": "Încărcați", "allowed-file-types": "Tipuri de fișiere permise sunt %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/ru/global.json b/public/language/ru/global.json index 2e453f412e..24cef36d23 100644 --- a/public/language/ru/global.json +++ b/public/language/ru/global.json @@ -95,5 +95,6 @@ "upload_file": "Загрузить файл", "upload": "Загрузить", "allowed-file-types": "Разрешенные форматы файлов %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/rw/global.json b/public/language/rw/global.json index 088182851c..bb0164820c 100644 --- a/public/language/rw/global.json +++ b/public/language/rw/global.json @@ -95,5 +95,6 @@ "upload_file": "Pakira ifayilo", "upload": "Pakira", "allowed-file-types": "Ubwoko bw'amafayilo bwemewe ni %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/sc/global.json b/public/language/sc/global.json index 7c70438c6c..a5b6a3e20f 100644 --- a/public/language/sc/global.json +++ b/public/language/sc/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/sk/global.json b/public/language/sk/global.json index f292d3f667..7a2ac8cbaa 100644 --- a/public/language/sk/global.json +++ b/public/language/sk/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/sl/global.json b/public/language/sl/global.json index 993d32a131..101d3c3af2 100644 --- a/public/language/sl/global.json +++ b/public/language/sl/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/sr/global.json b/public/language/sr/global.json index 6cee270049..8af7ca5b1d 100644 --- a/public/language/sr/global.json +++ b/public/language/sr/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/sv/global.json b/public/language/sv/global.json index 847c19a5c0..992f2a32fe 100644 --- a/public/language/sv/global.json +++ b/public/language/sv/global.json @@ -95,5 +95,6 @@ "upload_file": "Ladda upp en fil", "upload": "Ladda upp", "allowed-file-types": "Tillåtna filtyper är %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/th/global.json b/public/language/th/global.json index 4e4b7cccb7..09e26d956a 100644 --- a/public/language/th/global.json +++ b/public/language/th/global.json @@ -95,5 +95,6 @@ "upload_file": "Upload file", "upload": "Upload", "allowed-file-types": "Allowed file types are %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/tr/global.json b/public/language/tr/global.json index 54801fc108..9f9e5a1377 100644 --- a/public/language/tr/global.json +++ b/public/language/tr/global.json @@ -9,7 +9,7 @@ "404.message": "Erişim izniniz olmayan bir sayfaya denk gelmiş gibisiniz. Anasayfa'ya geri dönün.", "500.title": "Internal Error.", "500.message": "Ups! Bir şeyler ters gitti sanki!", - "400.title": "Bad Request.", + "400.title": "Geçersiz istek.", "400.message": "It looks like this link is malformed, please double-check and try again. Otherwise, return to the home page.", "register": "Kayıt Ol", "login": "Giriş", @@ -95,5 +95,6 @@ "upload_file": "Dosya yükle", "upload": "Yükle", "allowed-file-types": "İzin verilen dosya tipleri %1", - "unsaved-changes": "Kaydedilmemiş değişiklikler var. Çıkmak istediğinize emin misiniz?" + "unsaved-changes": "Kaydedilmemiş değişiklikler var. Çıkmak istediğinize emin misiniz?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/vi/global.json b/public/language/vi/global.json index 1043051526..01890dcd33 100644 --- a/public/language/vi/global.json +++ b/public/language/vi/global.json @@ -95,5 +95,6 @@ "upload_file": "Tải file lên", "upload": "Tải lên", "allowed-file-types": "Các định dạng file được cho phép là %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/zh_CN/global.json b/public/language/zh_CN/global.json index 9d6a0d5a47..c94f323598 100644 --- a/public/language/zh_CN/global.json +++ b/public/language/zh_CN/global.json @@ -95,5 +95,6 @@ "upload_file": "上传文件", "upload": "上传", "allowed-file-types": "允许的文件类型有 %1", - "unsaved-changes": "您有未保存的更改,您确定您要离开么?" + "unsaved-changes": "您有未保存的更改,您确定您要离开么?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file diff --git a/public/language/zh_TW/global.json b/public/language/zh_TW/global.json index f36d9ed09e..02e6ba741d 100644 --- a/public/language/zh_TW/global.json +++ b/public/language/zh_TW/global.json @@ -95,5 +95,6 @@ "upload_file": "上傳檔案", "upload": "上傳", "allowed-file-types": "允許的檔案類型是 %1", - "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?" + "unsaved-changes": "You have unsaved changes. Are you sure you wish to navigate away?", + "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." } \ No newline at end of file From 6e3d525ef4c2db6d3baa2961224f4423eda6186e Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 29 Aug 2016 16:12:27 +0300 Subject: [PATCH 06/54] closes #4704 --- public/src/client/topic/posts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index c6dfaaaaa6..3c70c09712 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -57,6 +57,7 @@ define('forum/topic/posts', [ function onNewPostPagination(data) { function scrollToPost() { scrollToPostIfSelf(data.posts[0]); + Posts.loadImages(); } var posts = data.posts; @@ -92,12 +93,13 @@ define('forum/topic/posts', [ html.addClass('new'); } scrollToPostIfSelf(data.posts[0]); + Posts.loadImages(); }); } function scrollToPostIfSelf(post) { if (!ajaxify.data.scrollToMyPost) { - return; + return; } var isSelfPost = parseInt(post.uid, 10) === parseInt(app.user.uid, 10); if (isSelfPost) { From 6e0a36909d090893191ef3498f008c518fb2cdd9 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 29 Aug 2016 19:08:48 +0300 Subject: [PATCH 07/54] fix pagination after jquery 3.0 update cache: false in $.ajax breaks the query string by adding _=timestamp the url results in `page.com/category/2/slug&page=2?_=timestamp` --- src/pagination.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pagination.js b/src/pagination.js index 15b8aa6eb3..69896ccd3f 100644 --- a/src/pagination.js +++ b/src/pagination.js @@ -35,6 +35,8 @@ pagination.create = function(currentPage, pageCount, queryObj) { queryObj = queryObj || {}; + delete queryObj._; + var pages = pagesToShow.map(function(page) { queryObj.page = page; return {page: page, active: page === currentPage, qs: qs.stringify(queryObj)}; From 0be557b846253ed5d45773af1002affc66b323b2 Mon Sep 17 00:00:00 2001 From: Anil Mandepudi Date: Mon, 29 Aug 2016 10:00:44 -0700 Subject: [PATCH 08/54] fixes #4991 (#4993) --- public/src/client/account/header.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js index 6b39b7f2da..97f062de11 100644 --- a/public/src/client/account/header.js +++ b/public/src/client/account/header.js @@ -1,23 +1,26 @@ 'use strict'; -/* globals define, app, config, ajaxify, socket, bootbox, translator */ +/* globals define, app, config, ajaxify, socket, bootbox, templates */ define('forum/account/header', [ 'coverPhoto', 'uploader', - 'components' -], function(coverPhoto, uploader, components) { - var AccountHeader = {}, - yourid, - theirid; + 'components', + 'translator' +], function(coverPhoto, uploader, components, translator) { + var AccountHeader = {}; + var yourid; + var theirid; + var isAdminOrSelfOrGlobalMod; AccountHeader.init = function() { yourid = ajaxify.data.yourid; theirid = ajaxify.data.theirid; + isAdminOrSelfOrGlobalMod = ajaxify.data.isAdmin || ajaxify.data.isSelf || ajaxify.data.isGlobalModerator; hidePrivateLinks(); selectActivePill(); - if (parseInt(yourid, 10) === parseInt(theirid, 10)) { + if (isAdminOrSelfOrGlobalMod) { setupCoverPhoto(); } From b854dd5150837db2be21fd46326fbdbe6a71b1b6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 29 Aug 2016 13:21:27 -0400 Subject: [PATCH 09/54] updated persona --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5db6ddf4aa..2ee13a2eff 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.13", - "nodebb-theme-persona": "4.1.36", + "nodebb-theme-persona": "4.1.37", "nodebb-theme-vanilla": "5.1.21", "nodebb-widget-essentials": "2.0.10", "nodemailer": "2.0.0", From 11be46ec2390cab61c718ccd7ca3dc7357f97f06 Mon Sep 17 00:00:00 2001 From: pichalite Date: Mon, 29 Aug 2016 17:42:29 +0000 Subject: [PATCH 10/54] fixes #4992 --- public/less/admin/general/navigation.less | 2 ++ public/src/admin/general/navigation.js | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/public/less/admin/general/navigation.less b/public/less/admin/general/navigation.less index 86fd3cae62..3e10639b89 100644 --- a/public/less/admin/general/navigation.less +++ b/public/less/admin/general/navigation.less @@ -3,6 +3,8 @@ width: 100%; min-height: 50px; border: 1px solid #eee; + overflow: auto; + .active { background-color: #eee; } diff --git a/public/src/admin/general/navigation.js b/public/src/admin/general/navigation.js index 9ebdce555a..3c4a25f066 100644 --- a/public/src/admin/general/navigation.js +++ b/public/src/admin/general/navigation.js @@ -13,17 +13,22 @@ define('admin/general/navigation', ['translator', 'iconSelect'], function(transl }); translator.translate(translator.unescape($('#available').html()), function(html) { - $('#available').html(html) - .find('li .drag-item').draggable({ - connectToSortable: '#active-navigation', - helper: 'clone', - distance: 10, - stop: drop - }); + app.loadJQueryUI(function() { + $('#available').html(html) + .find('li .drag-item').draggable({ + connectToSortable: '#active-navigation', + helper: 'clone', + distance: 10, + stop: drop + }); + }); }); + + app.loadJQueryUI(function() { - $('#active-navigation').sortable().droppable({ - accept: $('#available li .drag-item') + $('#active-navigation').sortable().droppable({ + accept: $('#available li .drag-item') + }); }); $('#enabled').on('click', '.iconPicker', function() { From 90ba8c6077af16d111569b2fb015fda4b9094e37 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 29 Aug 2016 16:23:03 -0400 Subject: [PATCH 11/54] update travis.yml supported node version, closes #4956 (#4995) --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffd3716c2a..b9d77e9558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,11 +19,10 @@ addons: packages: - g++-4.8 node_js: - - "4.2" - - "4.1" - - "4.0" - - "0.11" - - "0.10" + - "iojs" + - "6" + - "5" + - "4" branches: only: - master \ No newline at end of file From 8b1d324bd1d47c13a0dbc89be441fe4a077b84f1 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 29 Aug 2016 17:38:53 -0400 Subject: [PATCH 12/54] update copyright --- app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index c633af9932..72aa0e4142 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ /* NodeBB - A better forum platform for the modern web https://github.com/NodeBB/NodeBB/ - Copyright (C) 2013-2014 NodeBB Inc. + Copyright (C) 2013-2016 NodeBB Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ loadConfig(); if (!process.send) { // If run using `node app`, log GNU copyright info along with server info - winston.info('NodeBB v' + nconf.get('version') + ' Copyright (C) 2013-2014 NodeBB Inc.'); + winston.info('NodeBB v' + nconf.get('version') + ' Copyright (C) 2013-' + (new Date()).getFullYear() + ' NodeBB Inc.'); winston.info('This program comes with ABSOLUTELY NO WARRANTY.'); winston.info('This is free software, and you are welcome to redistribute it under certain conditions.'); winston.info(''); From 3ef7c57a63c03d3e4adb1f44d79f776ee093924c Mon Sep 17 00:00:00 2001 From: pichalite Date: Mon, 29 Aug 2016 21:53:12 +0000 Subject: [PATCH 13/54] make jquery ui a r.js module --- public/src/admin/general/navigation.js | 25 ++++++++++--------------- public/src/admin/modules/selectable.js | 8 +++----- src/meta/js.js | 2 +- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/public/src/admin/general/navigation.js b/public/src/admin/general/navigation.js index 3c4a25f066..1837fc590f 100644 --- a/public/src/admin/general/navigation.js +++ b/public/src/admin/general/navigation.js @@ -1,7 +1,7 @@ "use strict"; /* global define, app, ajaxify, socket, templates */ -define('admin/general/navigation', ['translator', 'iconSelect'], function(translator, iconSelect) { +define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], function(translator, iconSelect, jqueryui) { var navigation = {}, available; @@ -13,22 +13,17 @@ define('admin/general/navigation', ['translator', 'iconSelect'], function(transl }); translator.translate(translator.unescape($('#available').html()), function(html) { - app.loadJQueryUI(function() { - $('#available').html(html) - .find('li .drag-item').draggable({ - connectToSortable: '#active-navigation', - helper: 'clone', - distance: 10, - stop: drop - }); - }); + $('#available').html(html) + .find('li .drag-item').draggable({ + connectToSortable: '#active-navigation', + helper: 'clone', + distance: 10, + stop: drop + }); }); - app.loadJQueryUI(function() { - - $('#active-navigation').sortable().droppable({ - accept: $('#available li .drag-item') - }); + $('#active-navigation').sortable().droppable({ + accept: $('#available li .drag-item') }); $('#enabled').on('click', '.iconPicker', function() { diff --git a/public/src/admin/modules/selectable.js b/public/src/admin/modules/selectable.js index 815fa26d0f..5e4bb5725f 100644 --- a/public/src/admin/modules/selectable.js +++ b/public/src/admin/modules/selectable.js @@ -2,14 +2,12 @@ /*globals define*/ -define('admin/modules/selectable', function() { +define('admin/modules/selectable', ['jqueryui'], function(jqueryui) { var selectable = {}; selectable.enable = function(containerEl, targets) { - app.loadJQueryUI(function() { - $(containerEl).selectable({ - filter: targets - }); + $(containerEl).selectable({ + filter: targets }); }; diff --git a/src/meta/js.js b/src/meta/js.js index 3367734019..3d85c7efb1 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -80,7 +80,7 @@ module.exports = function(Meta) { modules: { "Chart.js": './node_modules/chart.js/dist/Chart.min.js', "mousetrap.js": './node_modules/mousetrap/mousetrap.js', - + "jqueryui.js": 'public/vendor/jquery/js/jquery-ui.js', "buzz.js": 'public/vendor/buzz/buzz.js' } } From af32d0ad408e46c0753284c8a20013a75482c00c Mon Sep 17 00:00:00 2001 From: pichalite Date: Tue, 30 Aug 2016 04:33:25 +0000 Subject: [PATCH 14/54] require jqueryui in admin/extend/widgets --- public/src/admin/extend/widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.js index 4ac3fdeaf0..799e3ae9bc 100644 --- a/public/src/admin/extend/widgets.js +++ b/public/src/admin/extend/widgets.js @@ -1,7 +1,7 @@ "use strict"; /* global define, app, socket */ -define('admin/extend/widgets', function() { +define('admin/extend/widgets', ['jqueryui'], function(jqueryui) { var Widgets = {}; Widgets.init = function() { From 4aac8bbe6a3968dd850b5f0294ecbec71a477607 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 13:10:48 +0300 Subject: [PATCH 15/54] closes #2222 --- src/image.js | 14 +++---- src/routes/debug.js | 14 +++---- src/topics.js | 2 +- src/topics/create.js | 3 ++ src/topics/thumb.js | 91 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 src/topics/thumb.js diff --git a/src/image.js b/src/image.js index fca120d1e5..f1e12c81d5 100644 --- a/src/image.js +++ b/src/image.js @@ -1,11 +1,11 @@ 'use strict'; -var fs = require('fs'), - Jimp = require('jimp'), - async = require('async'), - plugins = require('./plugins'); +var fs = require('fs'); +var Jimp = require('jimp'); +var async = require('async'); +var plugins = require('./plugins'); -var image = {}; +var image = module.exports; image.resizeImage = function(data, callback) { if (plugins.hasListeners('filter:image.resize')) { @@ -106,12 +106,10 @@ image.size = function(path, callback) { callback(err, data ? data.bitmap : null); }); } -} +}; image.convertImageToBase64 = function(path, callback) { fs.readFile(path, function(err, data) { callback(err, data ? data.toString('base64') : null); }); }; - -module.exports = image; diff --git a/src/routes/debug.js b/src/routes/debug.js index a24a159e18..a2191d8ffa 100644 --- a/src/routes/debug.js +++ b/src/routes/debug.js @@ -1,12 +1,12 @@ "use strict"; -var express = require('express'), - nconf = require('nconf'), - winston = require('winston'), - user = require('./../user'), - categories = require('./../categories'), - topics = require('./../topics'), - posts = require('./../posts'); +var express = require('express'); +var nconf = require('nconf'); +var winston = require('winston'); +var user = require('./../user'); +var categories = require('./../categories'); +var topics = require('./../topics'); +var posts = require('./../posts'); module.exports = function(app, middleware, controllers) { var router = express.Router(); diff --git a/src/topics.js b/src/topics.js index 4cb795b2c3..7d9938987a 100644 --- a/src/topics.js +++ b/src/topics.js @@ -14,7 +14,6 @@ var social = require('./social'); (function(Topics) { - require('./topics/data')(Topics); require('./topics/create')(Topics); require('./topics/delete')(Topics); @@ -29,6 +28,7 @@ var social = require('./social'); require('./topics/teaser')(Topics); require('./topics/suggested')(Topics); require('./topics/tools')(Topics); + require('./topics/thumb')(Topics); Topics.exists = function(tid, callback) { db.isSortedSetMember('topics:tid', tid, callback); diff --git a/src/topics/create.js b/src/topics/create.js index de55045ed8..db4976678c 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -21,6 +21,9 @@ module.exports = function(Topics) { var topicData; async.waterfall([ + function(next) { + Topics.resizeAndUploadThumb(data, next); + }, function(next) { db.incrObjectField('global', 'nextTid', next); }, diff --git a/src/topics/thumb.js b/src/topics/thumb.js new file mode 100644 index 0000000000..5829e080c4 --- /dev/null +++ b/src/topics/thumb.js @@ -0,0 +1,91 @@ + +'use strict'; + +var async = require('async'); +var nconf = require('nconf'); +var winston = require('winston'); +var path = require('path'); +var fs = require('fs'); +var request = require('request'); +var mime = require('mime'); +var validator = require('validator'); + +var meta = require('../meta'); +var image = require('../image'); +var file = require('../file'); +var plugins = require('../plugins'); + +module.exports = function(Topics) { + + Topics.resizeAndUploadThumb = function(data, callback) { + if (!data.thumb || !validator.isURL(data.thumb)) { + return callback(); + } + + var pathToUpload; + var filename; + + async.waterfall([ + function(next) { + request.head(data.thumb, next); + }, + function(res, body, next) { + + var type = res.headers['content-type']; + if (!type.match(/image./)) { + return next(new Error('[[error:invalid-file]]')); + } + + var extension = path.extname(data.thumb); + if (!extension) { + extension = '.' + mime.extension(type); + } + filename = Date.now() + '-topic-thumb' + extension; + pathToUpload = path.join(nconf.get('base_dir'), nconf.get('upload_path'), 'files', filename); + + request(data.thumb).pipe(fs.createWriteStream(pathToUpload)).on('close', next); + }, + function(next) { + file.isFileTypeAllowed(pathToUpload, next); + }, + function(next) { + var size = parseInt(meta.config.topicThumbSize, 10) || 120; + image.resizeImage({ + path: pathToUpload, + extension: path.extname(pathToUpload), + width: size, + height: size + }, next); + }, + function(next) { + if (!plugins.hasListeners('filter:uploadImage')) { + data.thumb = path.join(nconf.get('upload_url'), 'files', filename); + return callback(); + } + + plugins.fireHook('filter:uploadImage', {image: {path: pathToUpload, name: ''}, uid: data.uid}, next); + }, + function(uploadedFile, next) { + deleteFile(pathToUpload); + data.thumb = uploadedFile.url; + next(); + } + ], function(err) { + if (err) { + deleteFile(pathToUpload); + } + callback(err); + }); + }; + + function deleteFile(path) { + if (path) { + fs.unlink(path, function(err) { + if (err) { + winston.error(err); + } + }); + } + } + +}; From e33dfe3c554d05fc2f5c13fa9b72f17bb1e11986 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 13:17:48 +0300 Subject: [PATCH 16/54] closes #4997 --- src/controllers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index d39352e6d0..2689d58cbf 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -109,7 +109,7 @@ Controllers.login = function(req, res, next) { if (req.query.error === 'csrf-invalid') { errorText = '[[error:csrf-invalid]]'; } else if (req.query.error) { - errorText = req.query.error; + errorText = validator.escape(req.query.error); } data.alternate_logins = loginStrategies.length > 0; From 0eb3fb222f6ebc5a573a16d7b6ed5dc61025742a Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 13:19:04 +0300 Subject: [PATCH 17/54] convert to string --- src/controllers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index 2689d58cbf..f0927b1b07 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -109,7 +109,7 @@ Controllers.login = function(req, res, next) { if (req.query.error === 'csrf-invalid') { errorText = '[[error:csrf-invalid]]'; } else if (req.query.error) { - errorText = validator.escape(req.query.error); + errorText = validator.escape(String(req.query.error)); } data.alternate_logins = loginStrategies.length > 0; From 80c98e5ecfa000d7b4e617a5b649c1855f952fb3 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 13:25:20 +0300 Subject: [PATCH 18/54] closes #4989 --- app.js | 3 +++ src/socket.io/index.js | 6 +++--- src/webserver.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 72aa0e4142..205d0feff3 100644 --- a/app.js +++ b/app.js @@ -117,6 +117,9 @@ function start() { if (!nconf.get('upload_path')) { nconf.set('upload_path', '/public/uploads'); } + if (!nconf.get('sessionKey')) { + nconf.set('sessionKey', 'express.sid'); + } // Parse out the relative_url and other goodies from the configured URL var urlObject = url.parse(nconf.get('url')); var relativePath = urlObject.pathname !== '/' ? urlObject.pathname : ''; diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 3ec75ecd0d..5ee6050571 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -133,10 +133,10 @@ var ratelimit = require('../middleware/ratelimit'); function validateSession(socket, callback) { var req = socket.request; - if (!req.signedCookies || !req.signedCookies['express.sid']) { + if (!req.signedCookies || !req.signedCookies[nconf.get('sessionKey')]) { return callback(new Error('[[error:invalid-session]]')); } - db.sessionStore.get(req.signedCookies['express.sid'], function (err, sessionData) { + db.sessionStore.get(req.signedCookies[nconf.get('sessionKey')], function (err, sessionData) { if (err || !sessionData) { return callback(err || new Error('[[error:invalid-session]]')); } @@ -157,7 +157,7 @@ var ratelimit = require('../middleware/ratelimit'); cookieParser(request, {}, next); }, function (next) { - db.sessionStore.get(request.signedCookies['express.sid'], function (err, sessionData) { + db.sessionStore.get(request.signedCookies[nconf.get('sessionKey')], function (err, sessionData) { if (err) { return next(err); } diff --git a/src/webserver.js b/src/webserver.js index 94e44cc248..d7457e1b95 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -108,7 +108,7 @@ function setupExpressApp(app) { app.use(session({ store: db.sessionStore, secret: nconf.get('secret'), - key: 'express.sid', + key: nconf.get('sessionKey'), cookie: setupCookie(), resave: true, saveUninitialized: true From a9e4add8d2db1a58016b6c4f9a426497ca1c9cff Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 14:25:24 +0300 Subject: [PATCH 19/54] closes #4998 --- public/src/modules/navigator.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 93dc81ff06..ffc397bca0 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -227,12 +227,10 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com }; navigator.scrollToPostIndex = function(postIndex, highlight, duration) { - var scrollTo = components.get('post/anchor', postIndex), - postEl = components.get('post', 'index', postIndex), - postHeight = postEl.height(), - viewportHeight = $(window).height(), - navbarHeight = components.get('navbar').height(); - + var scrollTo = components.get('post', 'index', postIndex); + var postHeight = scrollTo.height(); + var viewportHeight = $(window).height(); + var navbarHeight = components.get('navbar').height(); if (!scrollTo.length) { navigator.scrollActive = false; @@ -275,9 +273,9 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com function highlightPost() { if (highlight) { - scrollTo.parents('[component="post"]').addClass('highlight'); + scrollTo.addClass('highlight'); setTimeout(function() { - scrollTo.parents('[component="post"]').removeClass('highlight'); + scrollTo.removeClass('highlight'); }, 10000); } } From 87c0f022d2b54dd3f116c023985f61b28671fe66 Mon Sep 17 00:00:00 2001 From: NodeBB Misty Date: Tue, 30 Aug 2016 09:02:35 -0400 Subject: [PATCH 20/54] Latest translations and fallbacks --- public/language/es/global.json | 2 +- public/language/es/notifications.json | 2 +- public/language/fa_IR/global.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/language/es/global.json b/public/language/es/global.json index 2162a64ee7..42a7109f6a 100644 --- a/public/language/es/global.json +++ b/public/language/es/global.json @@ -96,5 +96,5 @@ "upload": "Subir", "allowed-file-types": "Los tipos de archivos permitidos son: %1", "unsaved-changes": "Tienes cambios sin guardar. Seguro que quieres salir?", - "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." + "reconnecting-message": "Has perdido la conexión. Reconectando a %1." } \ No newline at end of file diff --git a/public/language/es/notifications.json b/public/language/es/notifications.json index aaab0f7d10..b0391106db 100644 --- a/public/language/es/notifications.json +++ b/public/language/es/notifications.json @@ -15,7 +15,7 @@ "upvoted_your_post_in_dual": "%1 y %2 han votado positivamente tu respuesta en %3.", "upvoted_your_post_in_multiple": "%1 y otras %2 personas han votado positivamente tu respuesta en %3.", "moved_your_post": "%1 su tema ha sido movido a %2", - "moved_your_topic": "%1 se ha movido %2", + "moved_your_topic": "%1 ha movido %2", "user_flagged_post_in": "%1 ha reportado una respuesta en %2", "user_flagged_post_in_dual": "%1 y %2 han reportado un post en %3", "user_flagged_post_in_multiple": "%1 y otras %2 personas han reportado un post en %3", diff --git a/public/language/fa_IR/global.json b/public/language/fa_IR/global.json index 7c7e92772d..386c069b39 100644 --- a/public/language/fa_IR/global.json +++ b/public/language/fa_IR/global.json @@ -96,5 +96,5 @@ "upload": "بارگذاری", "allowed-file-types": "فایل قابل قبول اینها هستند %1", "unsaved-changes": "تغییرات شما ذخیره نشده. شما مطمئن هستید که میخواهید از اینجا دور شوید؟", - "reconnecting-message": "Looks like your connection to %1 was lost, please wait while we try to reconnect." + "reconnecting-message": "اتصال شما به %1 به نظر می‌رسد از دست رفته. لطفا صبر کنید ما سعی می‌کنیم که دوباره شما را متصل کنیم." } \ No newline at end of file From 91aceced9e8815f571490148fe52213d100383c1 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 30 Aug 2016 20:43:32 +0300 Subject: [PATCH 21/54] up lavender --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ee13a2eff..b36eb57d12 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "nodebb-plugin-soundpack-default": "0.1.6", "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", - "nodebb-theme-lavender": "3.0.13", + "nodebb-theme-lavender": "3.0.14", "nodebb-theme-persona": "4.1.37", "nodebb-theme-vanilla": "5.1.21", "nodebb-widget-essentials": "2.0.10", From 9f064b67e6836a1d2e54101e63fab6c03868ae36 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 30 Aug 2016 17:01:51 -0400 Subject: [PATCH 22/54] closes #4956 --- app.js | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 205d0feff3..133b2f0800 100644 --- a/app.js +++ b/app.js @@ -54,6 +54,7 @@ if (nconf.get('config')) { var configExists = file.existsSync(configFile) || (nconf.get('url') && nconf.get('secret') && nconf.get('database')); loadConfig(); +versionCheck(); if (!process.send) { // If run using `node app`, log GNU copyright info along with server info @@ -350,3 +351,16 @@ function restart() { shutdown(1); } } + +function versionCheck() { + var version = process.version.slice(1); + var range = pkg.engines.node; + var semver = require('semver'); + var compatible = semver.satisfies(version, range); + + if (!compatible) { + winston.error('Your version of Node.js is too outdated for NodeBB. Please update your version of Node.js.'); + winston.error('Requires ' + range.green + ', '.reset + version.yellow + ' provided\n'.reset); + process.exit(1); + } +} \ No newline at end of file diff --git a/package.json b/package.json index b36eb57d12..140bbd5ef6 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "url": "https://github.com/NodeBB/NodeBB/issues" }, "engines": { - "node": ">=0.10" + "node": ">=4" }, "maintainers": [ { From 5eae8b2d4ff4034b78ed41d7f5b304418ba1b358 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 30 Aug 2016 17:03:49 -0400 Subject: [PATCH 23/54] re: #4956, made it a recommendation instead, not a hard requirement --- app.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 133b2f0800..c348cbfed5 100644 --- a/app.js +++ b/app.js @@ -359,8 +359,7 @@ function versionCheck() { var compatible = semver.satisfies(version, range); if (!compatible) { - winston.error('Your version of Node.js is too outdated for NodeBB. Please update your version of Node.js.'); - winston.error('Requires ' + range.green + ', '.reset + version.yellow + ' provided\n'.reset); - process.exit(1); + winston.warn('Your version of Node.js is too outdated for NodeBB. Please update your version of Node.js.'); + winston.warn('Recommended ' + range.green + ', '.reset + version.yellow + ' provided\n'.reset); } } \ No newline at end of file From cb940fec2819d9a21842d642ca9b4c2232daf2b2 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 30 Aug 2016 17:09:35 -0400 Subject: [PATCH 24/54] so no iojs then :wink: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b9d77e9558..82838ced67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,6 @@ addons: packages: - g++-4.8 node_js: - - "iojs" - "6" - "5" - "4" From 532a54322648af729596d0b36c3fc4bc29c9f43c Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 02:14:04 +0300 Subject: [PATCH 25/54] closes #4999 $(document).offset() crashes on jquery 3.0 --- public/src/client/infinitescroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/src/client/infinitescroll.js b/public/src/client/infinitescroll.js index ed21602b01..1823b15ca3 100644 --- a/public/src/client/infinitescroll.js +++ b/public/src/client/infinitescroll.js @@ -13,10 +13,10 @@ define('forum/infinitescroll', function() { scroll.init = function(el, cb) { if (typeof el === 'function') { callback = el; - container = $(document); + container = $('body'); } else { callback = cb; - container = el || $(document); + container = el || $('body'); } $(window).off('scroll', onScroll).on('scroll', onScroll); From d4055ddaef3abc583afffb33cc2d8608e8b78425 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 14:25:36 +0300 Subject: [PATCH 26/54] no need for pubsub in getNodeInfo --- src/controllers/admin/info.js | 7 +++---- src/socket.io/admin/rooms.js | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/controllers/admin/info.js b/src/controllers/admin/info.js index 00a5694937..80b0829487 100644 --- a/src/controllers/admin/info.js +++ b/src/controllers/admin/info.js @@ -62,9 +62,8 @@ function getNodeInfo(callback) { }; async.parallel({ - pubsub: function(next) { - pubsub.publish('sync:stats:start'); - next(); + stats: function(next) { + rooms.getLocalStats(next); }, gitInfo: function(next) { getGitInfo(next); @@ -74,7 +73,7 @@ function getNodeInfo(callback) { return callback(err); } data.git = results.gitInfo; - data.stats = rooms.stats[data.os.hostname + ':' + data.process.port]; + data.stats = results.stats; callback(null, data); }); } diff --git a/src/socket.io/admin/rooms.js b/src/socket.io/admin/rooms.js index b5f4ffb501..fcb52debe1 100644 --- a/src/socket.io/admin/rooms.js +++ b/src/socket.io/admin/rooms.js @@ -17,7 +17,7 @@ var SocketRooms = { pubsub.on('sync:stats:start', function() { - getLocalStats(function(err, stats) { + SocketRooms.getLocalStats(function(err, stats) { if (err) { return winston.error(err); } @@ -50,7 +50,7 @@ SocketRooms.getTotalGuestCount = function(callback) { pubsub.removeAllListeners('sync:stats:guests:end'); callback(null, count); }, 100); -} +}; SocketRooms.getAll = function(socket, data, callback) { @@ -129,7 +129,7 @@ SocketRooms.getOnlineUserCount = function(io) { return count; }; -function getLocalStats(callback) { +SocketRooms.getLocalStats = function(callback) { var io = require('../index').server; if (!io) { @@ -172,7 +172,7 @@ function getLocalStats(callback) { socketData.topics = topTenTopics; callback(null, socketData); -} +}; module.exports = SocketRooms; \ No newline at end of file From 194716cd6862c0fec44b20884b9c174c4f8b577d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 31 Aug 2016 12:20:47 -0400 Subject: [PATCH 27/54] re: #5002 --- public/language/en_GB/user.json | 4 ++- public/less/generics.less | 14 ++++---- public/src/admin/manage/users.js | 4 +-- public/src/client/account/header.js | 2 +- src/socket.io/user/ban.js | 9 ++--- src/user/admin.js | 19 +++++++--- src/user/info.js | 10 +++++- src/views/admin/partials/temporary-ban.tpl | 41 ++++++++++++++++------ 8 files changed, 73 insertions(+), 30 deletions(-) diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index 5863d4d67c..6bfb23bb73 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -137,5 +137,7 @@ "info.ban-history": "Recent Ban History", "info.no-ban-history": "This user has never been banned", "info.banned-until": "Banned until %1", - "info.banned-permanently": "Banned permanently" + "info.banned-permanently": "Banned permanently", + "info.banned-reason-label": "Reason", + "info.banned-no-reason": "No reason given." } diff --git a/public/less/generics.less b/public/less/generics.less index d2be83d01e..f94118b299 100644 --- a/public/less/generics.less +++ b/public/less/generics.less @@ -112,13 +112,15 @@ } .ban-modal { - input[type="number"] { - width: 7rem; - text-align: center; - margin-left: 1rem; - } - .form-inline, .form-group { width: 100%; } + + .units { + line-height: 5rem; + } +} + +.admin .ban-modal .units { + line-height: 1.846; } \ No newline at end of file diff --git a/public/src/admin/manage/users.js b/public/src/admin/manage/users.js index d570941940..45abb0e254 100644 --- a/public/src/admin/manage/users.js +++ b/public/src/admin/manage/users.js @@ -60,7 +60,7 @@ define('admin/manage/users', ['admin/modules/selectable', 'translator'], functio bootbox.confirm('Do you really want to ban ' + (uids.length > 1 ? 'these users' : 'this user') + ' permanently?', function(confirm) { if (confirm) { - socket.emit('user.banUsers', { uids: uids }, done('User(s) banned!', '.ban', true)); + socket.emit('user.banUsers', { uids: uids, reason: '' }, done('User(s) banned!', '.ban', true)); } }); }); @@ -91,7 +91,7 @@ define('admin/manage/users', ['admin/modules/selectable', 'translator'], functio return data; }, {}); var until = formData.length ? (Date.now() + formData.length * 1000*60*60 * (parseInt(formData.unit, 10) ? 24 : 1)) : 0; - socket.emit('user.banUsers', { uids: uids, until: until }, done('User(s) banned!', '.ban', true)); + socket.emit('user.banUsers', { uids: uids, until: until, reason: formData.reason }, done('User(s) banned!', '.ban', true)); } } } diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js index 97f062de11..2a6641b152 100644 --- a/public/src/client/account/header.js +++ b/public/src/client/account/header.js @@ -126,7 +126,7 @@ define('forum/account/header', [ }, {}); var until = formData.length ? (Date.now() + formData.length * 1000*60*60 * (parseInt(formData.unit, 10) ? 24 : 1)) : 0; - socket.emit('user.banUsers', { uids: [ajaxify.data.theirid], until: until }, function(err) { + socket.emit('user.banUsers', { uids: [ajaxify.data.theirid], until: until, reason: formData.reason || '' }, function(err) { if (err) { return app.alertError(err.message); } diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index 41c60411e0..80f701c1a2 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -12,12 +12,13 @@ module.exports = function(SocketUser) { if (Array.isArray(data)) { data = { uids: data, - until: 0 + until: 0, + reason: '' }; } toggleBan(socket.uid, data.uids, function(uid, next) { - banUser(data.until || 0, uid, next); + banUser(uid, data.until || 0, data.reason || '', next); }, function(err) { if (err) { return callback(err); @@ -68,7 +69,7 @@ module.exports = function(SocketUser) { ], callback); } - function banUser(until, uid, callback) { + function banUser(uid, until, reason, callback) { async.waterfall([ function (next) { user.isAdministrator(uid, next); @@ -77,7 +78,7 @@ module.exports = function(SocketUser) { if (isAdmin) { return next(new Error('[[error:cant-ban-other-admins]]')); } - user.ban(uid, until, next); + user.ban(uid, until, reason, next); }, function (next) { websockets.in('uid_' + uid).emit('event:banned'); diff --git a/src/user/admin.js b/src/user/admin.js index dd3134e442..2509028b55 100644 --- a/src/user/admin.js +++ b/src/user/admin.js @@ -53,13 +53,20 @@ module.exports = function(User) { ], callback); }; - User.ban = function(uid, until, callback) { + User.ban = function(uid, until, reason, callback) { // "until" (optional) is unix timestamp in milliseconds + // "reason" (optional) is a string if (!callback && typeof until === 'function') { callback = until; until = 0; + reason = ''; + } else if (!callback && typeof reason === 'function') { + callback = reason; + reason = ''; } + var now = Date.now(); + until = parseInt(until, 10); if (isNaN(until)) { return callback(new Error('[[error:ban-expiry-missing]]')); @@ -67,17 +74,21 @@ module.exports = function(User) { var tasks = [ async.apply(User.setUserField, uid, 'banned', 1), - async.apply(db.sortedSetAdd, 'users:banned', Date.now(), uid), - async.apply(db.sortedSetAdd, 'uid:' + uid + ':bans', Date.now(), until) + async.apply(db.sortedSetAdd, 'users:banned', now, uid), + async.apply(db.sortedSetAdd, 'uid:' + uid + ':bans', now, until) ]; - if (until > 0 && Date.now() < until) { + if (until > 0 && now < until) { tasks.push(async.apply(db.sortedSetAdd, 'users:banned:expire', until, uid)); tasks.push(async.apply(User.setUserField, uid, 'banned:expire', until)); } else { until = 0; } + if (reason) { + tasks.push(async.apply(db.sortedSetAdd, 'banned:' + uid + ':reasons', now, reason)); + } + async.series(tasks, function (err) { if (err) { return callback(err); diff --git a/src/user/info.js b/src/user/info.js index da85e25116..fdd401dcd8 100644 --- a/src/user/info.js +++ b/src/user/info.js @@ -13,7 +13,8 @@ module.exports = function(User) { function(next) { async.parallel({ flags: async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':flag:pids', 0, 19), - bans: async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0,19) + bans: async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0, 19), + reasons: async.apply(db.getSortedSetRevRangeWithScores, 'banned:' + uid + ':reasons', 0, 19) }, next); }, function(data, next) { @@ -64,15 +65,22 @@ module.exports = function(User) { } function formatBanData(data) { + var reasons = data.reasons.reduce(function(memo, cur) { + memo[cur.score] = cur.value; + return memo; + }, {}); + data.bans = data.bans.map(function(banObj) { banObj.until = parseInt(banObj.value, 10); banObj.untilReadable = new Date(banObj.until).toString(); banObj.timestamp = parseInt(banObj.score, 10); banObj.timestampReadable = new Date(banObj.score).toString(); banObj.timestampISO = new Date(banObj.score).toISOString(); + banObj.reason = reasons[banObj.score] || '[[user:info.banned-no-reason]]'; delete banObj.value; delete banObj.score; + delete data.reasons; return banObj; }); diff --git a/src/views/admin/partials/temporary-ban.tpl b/src/views/admin/partials/temporary-ban.tpl index a3f032a3b6..da8d02c79f 100644 --- a/src/views/admin/partials/temporary-ban.tpl +++ b/src/views/admin/partials/temporary-ban.tpl @@ -1,13 +1,32 @@ -
-
- -
- - - - + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +    + + +
+
+
+

+ Enter the length of time for the ban. Note that a time of 0 will be a considered a permanent ban. +

+
-

- Enter the length of time for the ban. Note that a time of 0 will be a considered a permanent ban. -

\ No newline at end of file From a027dbfecdc5cd730a7cccd286a52486377bebb6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 31 Aug 2016 12:22:30 -0400 Subject: [PATCH 28/54] up themes, re: #5002 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 140bbd5ef6..f9bb14a6c4 100644 --- a/package.json +++ b/package.json @@ -58,8 +58,8 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.14", - "nodebb-theme-persona": "4.1.37", - "nodebb-theme-vanilla": "5.1.21", + "nodebb-theme-persona": "4.1.38", + "nodebb-theme-vanilla": "5.1.22", "nodebb-widget-essentials": "2.0.10", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", From fe3417538c99a4cba96f28e7ebea76ac29e0f4e0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 21:22:28 +0300 Subject: [PATCH 29/54] fix getSortedSetRange() if start>0 and stop is -1 --- src/database/mongo/sorted.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index 5cc06eab42..33e6d4e79b 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -141,8 +141,13 @@ module.exports = function(db, module) { key = {$in: key}; } + var limit = stop - start + 1; + if (limit <= 0) { + limit = 0; + } + db.collection('objects').find({_key: key}, {fields: fields}) - .limit(stop - start + 1) + .limit(limit) .skip(start) .sort({score: sort}) .toArray(function(err, data) { From fea2267b5851d25e0136ee31ec59b1defa2d1649 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 21:22:58 +0300 Subject: [PATCH 30/54] fix navigator.scrollToPost() pagination and alternate sort page calculation --- public/src/modules/navigator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index ffc397bca0..b5c415ad78 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -210,7 +210,11 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com } if (config.usePagination) { - var page = Math.max(1, Math.ceil(postIndex / config.postsPerPage)); + var index = postIndex; + if (config.topicPostSort === 'most_votes' || config.topicPostSort === 'newest_to_oldest') { + index = ajaxify.data.postcount - 1 - index; + } + var page = Math.max(1, Math.ceil(index / config.postsPerPage)); if (parseInt(page, 10) !== ajaxify.data.pagination.currentPage) { pagination.loadPage(page, function() { From b0f630aaec44c8b272b5dcea5066240be20e0f38 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 21:39:02 +0300 Subject: [PATCH 31/54] always use string as cache key --- src/posts/edit.js | 4 ++-- src/posts/parse.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/posts/edit.js b/src/posts/edit.js index 333901c1fa..5bb76ec019 100644 --- a/src/posts/edit.js +++ b/src/posts/edit.js @@ -68,8 +68,8 @@ module.exports = function(Posts) { plugins.fireHook('action:post.edit', _.clone(postData)); - cache.del(postData.pid); - pubsub.publish('post:edit', postData.pid); + cache.del(String(postData.pid)); + pubsub.publish('post:edit', String(postData.pid)); Posts.parsePost(postData, next); }, diff --git a/src/posts/parse.js b/src/posts/parse.js index 19e6430681..88fa5f8c22 100644 --- a/src/posts/parse.js +++ b/src/posts/parse.js @@ -15,8 +15,8 @@ module.exports = function(Posts) { Posts.parsePost = function(postData, callback) { postData.content = postData.content || ''; - if (postData.pid && cache.has(postData.pid)) { - postData.content = cache.get(postData.pid); + if (postData.pid && cache.has(String(postData.pid))) { + postData.content = cache.get(String(postData.pid)); return callback(null, postData); } @@ -33,7 +33,7 @@ module.exports = function(Posts) { data.postData.content = translator.escape(data.postData.content); if (global.env === 'production' && data.postData.pid) { - cache.set(data.postData.pid, data.postData.content); + cache.set(String(data.postData.pid), data.postData.content); } callback(null, data.postData); From 240682563d1f530c5c75f0370583b9dbc39dab5b Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 22:15:33 +0300 Subject: [PATCH 32/54] fix index error --- public/src/modules/navigator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index b5c415ad78..a70ca1939a 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -212,7 +212,7 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com if (config.usePagination) { var index = postIndex; if (config.topicPostSort === 'most_votes' || config.topicPostSort === 'newest_to_oldest') { - index = ajaxify.data.postcount - 1 - index; + index = ajaxify.data.postcount - index; } var page = Math.max(1, Math.ceil(index / config.postsPerPage)); From 7afd2925afec23817291e21d0fb6c53ecef97fa1 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 22:50:48 +0300 Subject: [PATCH 33/54] get sort setting from config --- public/src/client/category.js | 3 ++- public/src/client/topic/posts.js | 3 ++- src/socket.io/categories.js | 8 ++++---- src/socket.io/topics/infinitescroll.js | 9 +++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/public/src/client/category.js b/public/src/client/category.js index af0d26b980..80d8d10539 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -277,7 +277,8 @@ define('forum/category', [ cid: ajaxify.data.cid, after: after, direction: direction, - author: utils.params().author + author: utils.params().author, + categoryTopicSort: config.categoryTopicSort }, function (data, done) { if (data.topics && data.topics.length) { Category.onTopicsLoaded(data, direction, done); diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 3c70c09712..6aae064794 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -222,7 +222,8 @@ define('forum/topic/posts', [ infinitescroll.loadMore('topics.loadMore', { tid: tid, after: after, - direction: direction + direction: direction, + topicPostSort: config.topicPostSort }, function (data, done) { indicatorEl.fadeOut(); diff --git a/src/socket.io/categories.js b/src/socket.io/categories.js index 1c13adebea..a8957a10dc 100644 --- a/src/socket.io/categories.js +++ b/src/socket.io/categories.js @@ -80,12 +80,12 @@ SocketCategories.loadMore = function(socket, data, callback) { } var infScrollTopicsPerPage = 20; - var set = 'cid:' + data.cid + ':tids', - reverse = false; + var set = 'cid:' + data.cid + ':tids'; + var reverse = false; - if (results.settings.categoryTopicSort === 'newest_to_oldest') { + if (data.categoryTopicSort === 'newest_to_oldest') { reverse = true; - } else if (results.settings.categoryTopicSort === 'most_posts') { + } else if (data.categoryTopicSort === 'most_posts') { reverse = true; set = 'cid:' + data.cid + ':tids:posts'; } diff --git a/src/socket.io/topics/infinitescroll.js b/src/socket.io/topics/infinitescroll.js index 5f089bd52e..7401c60e1f 100644 --- a/src/socket.io/topics/infinitescroll.js +++ b/src/socket.io/topics/infinitescroll.js @@ -1,7 +1,7 @@ 'use strict'; var async = require('async'); -var user = require('../../user'); + var topics = require('../../topics'); var privileges = require('../../privileges'); var meta = require('../../meta'); @@ -19,9 +19,6 @@ module.exports = function(SocketTopics) { privileges: function(next) { privileges.topics.get(data.tid, socket.uid, next); }, - settings: function(next) { - user.getSettings(socket.uid, next); - }, topic: function(next) { topics.getTopicFields(data.tid, ['postcount', 'deleted'], next); } @@ -35,10 +32,10 @@ module.exports = function(SocketTopics) { } var set = 'tid:' + data.tid + ':posts'; - if (results.settings.topicPostSort === 'most_votes') { + if (data.topicPostSort === 'most_votes') { set = 'tid:' + data.tid + ':posts:votes'; } - var reverse = results.settings.topicPostSort === 'newest_to_oldest' || results.settings.topicPostSort === 'most_votes'; + var reverse = data.topicPostSort === 'newest_to_oldest' || data.topicPostSort === 'most_votes'; var start = Math.max(0, parseInt(data.after, 10)); var infScrollPostsPerPage = 10; From b84f36cc201c61cc65af85729eea6e7afe75d2d0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 23:15:17 +0300 Subject: [PATCH 34/54] fix navigator method not getting removed --- public/src/modules/navigator.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index a70ca1939a..de49cfd1f7 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -9,6 +9,8 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com var navigator = {}; var index = 1; var count = 0; + var navigatorUpdateTimeoutId = 0; + navigator.scrollActive = false; navigator.init = function(selector, count, toTop, toBottom, callback, calculateIndex) { @@ -17,15 +19,8 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com navigator.callback = callback; toTop = toTop || function() {}; toBottom = toBottom || function() {}; - var navigatorUpdateTimeoutId = 0; - $(window).off('scroll', navigator.update).on('scroll', function() { - if (navigatorUpdateTimeoutId) { - clearTimeout(navigatorUpdateTimeoutId); - navigatorUpdateTimeoutId = 0; - } - navigatorUpdateTimeoutId = setTimeout(navigator.update, 100); - }); + $(window).off('scroll', navigator.delayedUpdate).on('scroll', navigator.delayedUpdate); $('.pagination-block .dropdown-menu').off('click').on('click', function(e) { e.stopPropagation(); @@ -98,6 +93,14 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com $('.pagination-block').toggleClass('ready', flag); } + navigator.delayedUpdate = function() { + if (navigatorUpdateTimeoutId) { + clearTimeout(navigatorUpdateTimeoutId); + navigatorUpdateTimeoutId = 0; + } + navigatorUpdateTimeoutId = setTimeout(navigator.update, 100); + }; + navigator.update = function(threshold) { /* The "threshold" is defined as the distance from the top of the page to @@ -136,7 +139,7 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com } else if (nearBottom) { index = count; } - +console.log('wtf', index ,count) // If a threshold is undefined, try to determine one based on new index if (threshold === undefined && ajaxify.data.template.topic === true) { if (atTop) { From 8868668daadf620462928e523977e8a9b4d1a72f Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 23:23:25 +0300 Subject: [PATCH 35/54] fix navigator displaying wrong index related to #4998 --- public/src/client/topic.js | 2 +- public/src/modules/navigator.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index dcff9d3fe1..be41d85ac7 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -63,7 +63,7 @@ define('forum/topic', [ handleKeys(); - navigator.init('[component="post/anchor"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex); + navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex); handleBookmark(tid); diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index de49cfd1f7..8865a764c5 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -131,8 +131,8 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com } }); - var atTop = scrollTop === 0 && parseInt(els.first().attr('data-index'), 10) === 0, - nearBottom = scrollTop + windowHeight > documentHeight - 100 && parseInt(els.last().attr('data-index'), 10) === count - 1; + var atTop = scrollTop === 0 && parseInt(els.first().attr('data-index'), 10) === 0; + var nearBottom = scrollTop + windowHeight > documentHeight - 100 && parseInt(els.last().attr('data-index'), 10) === count - 1; if (atTop) { index = 1; From 90fbe731887cb2ea0135a2a6416e958a67cda72e Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 31 Aug 2016 23:28:41 +0300 Subject: [PATCH 36/54] up themes --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f9bb14a6c4..51a1753e0e 100644 --- a/package.json +++ b/package.json @@ -58,8 +58,8 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.14", - "nodebb-theme-persona": "4.1.38", - "nodebb-theme-vanilla": "5.1.22", + "nodebb-theme-persona": "4.1.39", + "nodebb-theme-vanilla": "5.1.23", "nodebb-widget-essentials": "2.0.10", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", From fc68b64fe0565a9252c7f54a82b455f800658c97 Mon Sep 17 00:00:00 2001 From: Timothy Fike Date: Wed, 31 Aug 2016 20:17:11 -0400 Subject: [PATCH 37/54] New topic from anywhere. Like on the navbar. --- public/src/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index e086787215..0e357dc50e 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -33,7 +33,7 @@ app.cacheBuster = null; app.handleSearch(); } - $('#content').on('click', '#new_topic', function(){ + $('body').on('click', '#new_topic', function(){ app.newTopic(); }); From 9c064d8facc489d428950b015cef3b009cc3621c Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 1 Sep 2016 13:55:53 +0300 Subject: [PATCH 38/54] only process embedded tpls --- public/src/ajaxify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 87122bf78c..f7cbe1c26b 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -380,7 +380,7 @@ $(document).ready(function() { app.load(); - $('[data-template]').each(function() { + $('[type="text/tpl"][data-template]').each(function() { templates.cache[$(this).attr('data-template')] = $('
').html($(this).html()).text(); $(this).parent().remove(); }); From 6acfb0231699d177106d088d22c497a8821cfd83 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 1 Sep 2016 14:12:17 +0300 Subject: [PATCH 39/54] closes #4996 --- public/src/admin/extend/widgets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.js index 799e3ae9bc..91e05beb04 100644 --- a/public/src/admin/extend/widgets.js +++ b/public/src/admin/extend/widgets.js @@ -4,7 +4,7 @@ define('admin/extend/widgets', ['jqueryui'], function(jqueryui) { var Widgets = {}; - Widgets.init = function() { + Widgets.init = function() { $('#widgets .nav-pills a').on('click', function(ev) { var $this = $(this); $('#widgets .nav-pills li').removeClass('active'); @@ -21,7 +21,7 @@ define('admin/extend/widgets', ['jqueryui'], function(jqueryui) { $('.available-widgets [data-widget]').addClass('hide'); $('.available-widgets [data-widget="' + $(this).val() + '"]').removeClass('hide'); }); - + $('#widget-selector').trigger('change'); loadWidgetData(); @@ -32,7 +32,7 @@ define('admin/extend/widgets', ['jqueryui'], function(jqueryui) { $('#widgets .available-widgets .widget-panel').draggable({ helper: function(e) { - return $(e.target).parents('.widget-panel').clone().addClass('block').width($(e.target.parentNode).width()); + return $(e.target).parents('.widget-panel').clone(); }, distance: 10, connectToSortable: ".widget-area" @@ -156,7 +156,7 @@ define('admin/extend/widgets', ['jqueryui'], function(jqueryui) { function appendToggle(el) { if (!el.hasClass('block')) { - el.addClass('block') + el.addClass('block').css('width', '').css('height', '') .droppable({ accept: '[data-container-html]', drop: function(event, ui) { From 55c9e6f4b621c6597496f2ac4832c79ff5901b65 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 1 Sep 2016 15:32:47 +0300 Subject: [PATCH 40/54] closes #3818 set the value saved to empty string if the email is identical to original this causes the original to be used since empty string is falsy --- public/src/admin/settings/email.js | 17 ++++++++++++----- src/controllers/admin/settings.js | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js index 78a058e19d..02edfffcaa 100644 --- a/public/src/admin/settings/email.js +++ b/public/src/admin/settings/email.js @@ -34,16 +34,23 @@ define('admin/settings/email', ['admin/settings'], function(settings) { emailEditor.setTheme("ace/theme/twilight"); emailEditor.getSession().setMode("ace/mode/html"); - emailEditor.on('change', function(event) { - $('#email-editor-holder').val(emailEditor.getValue()); + emailEditor.on('change', function() { + var emailPath = $('#email-editor-selector').val(); + var original; + ajaxify.data.emails.forEach(function(email) { + if (email.path === emailPath) { + original = email.original; + } + }); + var newEmail = emailEditor.getValue(); + $('#email-editor-holder').val(newEmail !== original ? newEmail : ''); }); $('button[data-action="email.revert"]').off('click').on('click', function() { ajaxify.data.emails.forEach(function(email) { if (email.path === $('#email-editor-selector').val()) { emailEditor.getSession().setValue(email.original); - $('#email-editor-holder') - .val(email.original); + $('#email-editor-holder').val(''); } }); }); @@ -56,7 +63,7 @@ define('admin/settings/email', ['admin/settings'], function(settings) { if (email.path === $('#email-editor-selector').val()) { emailEditor.getSession().setValue(email.text); $('#email-editor-holder') - .val(email.text) + .val(email.text !== email.original ? email.text : '') .attr('data-field', 'email:custom:' + email.path); } }); diff --git a/src/controllers/admin/settings.js b/src/controllers/admin/settings.js index 50c44ef1b7..13e7b42722 100644 --- a/src/controllers/admin/settings.js +++ b/src/controllers/admin/settings.js @@ -19,9 +19,9 @@ settingsController.get = function(req, res, next) { function renderEmail(req, res, next) { - var fs = require('fs'), - path = require('path'), - utils = require('../../../public/src/utils'); + var fs = require('fs'); + var path = require('path'); + var utils = require('../../../public/src/utils'); var emailsPath = path.join(__dirname, '../../../public/templates/emails'); utils.walk(emailsPath, function(err, emails) { From 162f14b229bd5aebd9c576135a6005036bf9de1d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 1 Sep 2016 15:44:10 +0300 Subject: [PATCH 41/54] closes #4908 --- public/src/admin/extend/plugins.js | 2 ++ src/views/admin/extend/plugins.tpl | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/public/src/admin/extend/plugins.js b/public/src/admin/extend/plugins.js index eccb94f527..3e12074e3a 100644 --- a/public/src/admin/extend/plugins.js +++ b/public/src/admin/extend/plugins.js @@ -249,6 +249,8 @@ define('admin/extend/plugins', function() { $('#installed ul li').each(function() { if ($(this).hasClass('active')) { $('#active ul').append($(this).clone(true)); + } else { + $('#deactive ul').append($(this).clone(true)); } }); } diff --git a/src/views/admin/extend/plugins.tpl b/src/views/admin/extend/plugins.tpl index 1e240b7fd6..7f7caee844 100644 --- a/src/views/admin/extend/plugins.tpl +++ b/src/views/admin/extend/plugins.tpl @@ -1,6 +1,7 @@