Merge remote-tracking branch 'refs/remotes/origin/master' into develop

# Conflicts:
#	package.json
v1.18.x
Baris Usakli 8 years ago
commit c4310395c9

@ -61,7 +61,7 @@
"nodebb-plugin-emoji-extended": "1.1.1", "nodebb-plugin-emoji-extended": "1.1.1",
"nodebb-plugin-emoji-one": "1.2.1", "nodebb-plugin-emoji-one": "1.2.1",
"nodebb-plugin-markdown": "8.2.0", "nodebb-plugin-markdown": "8.2.0",
"nodebb-plugin-mentions": "2.1.6", "nodebb-plugin-mentions": "2.1.7",
"nodebb-plugin-soundpack-default": "1.0.0", "nodebb-plugin-soundpack-default": "1.0.0",
"nodebb-plugin-spam-be-gone": "0.5.1", "nodebb-plugin-spam-be-gone": "0.5.1",
"nodebb-rewards-essentials": "0.0.9", "nodebb-rewards-essentials": "0.0.9",

@ -15,10 +15,10 @@
"smtp-transport.gmail-warning2": "Um mehr zu diesem Workaround zu erfahren, ließ dir bitten <a href=\"https://nodemailer.com/usage/using-gmail/\">diesen NodeMailer Artikel zu diesem Problem durch</a>. Eine Alternative wäre, Emailer-Plugins von dritten wie etwa SendGrid, Mailgun usw. zu verwenden. <a href=\"{config.relative_path}/admin/extend/plugins\">Verfügbare Plugins durchsuchen</a>.", "smtp-transport.gmail-warning2": "Um mehr zu diesem Workaround zu erfahren, ließ dir bitten <a href=\"https://nodemailer.com/usage/using-gmail/\">diesen NodeMailer Artikel zu diesem Problem durch</a>. Eine Alternative wäre, Emailer-Plugins von dritten wie etwa SendGrid, Mailgun usw. zu verwenden. <a href=\"{config.relative_path}/admin/extend/plugins\">Verfügbare Plugins durchsuchen</a>.",
"smtp-transport.host": "SMTP Host", "smtp-transport.host": "SMTP Host",
"smtp-transport.port": "SMTP Port", "smtp-transport.port": "SMTP Port",
"smtp-transport.security": "Connection security", "smtp-transport.security": "Verbindungssicherheit",
"smtp-transport.security-encrypted": "Encrypted", "smtp-transport.security-encrypted": "Verschlüsselt",
"smtp-transport.security-starttls": "StartTLS", "smtp-transport.security-starttls": "StartTLS",
"smtp-transport.security-none": "None", "smtp-transport.security-none": "Keine",
"smtp-transport.username": "Benutzername", "smtp-transport.username": "Benutzername",
"smtp-transport.username-help": "Bitte füge die komplette Email-Adresse <b>für Gmail</b> hier ein, insbesondere wenn du eine von Google Apps gemanagete domain verwendest.", "smtp-transport.username-help": "Bitte füge die komplette Email-Adresse <b>für Gmail</b> hier ein, insbesondere wenn du eine von Google Apps gemanagete domain verwendest.",
"smtp-transport.password": "Passwort", "smtp-transport.password": "Passwort",

@ -31,7 +31,7 @@
"notif.post.cta": "Hier klicken, um das gesamte Thema zu lesen", "notif.post.cta": "Hier klicken, um das gesamte Thema zu lesen",
"notif.post.unsub.info": "Diese Mitteilung wurde dir aufgrund deiner Abonnement-Einstellungen gesendet.", "notif.post.unsub.info": "Diese Mitteilung wurde dir aufgrund deiner Abonnement-Einstellungen gesendet.",
"test.text1": "Dies ist eine Test-E-Mail, um zu überprüfen, ob der E-Mailer deines NodeBB korrekt eingestellt wurde.", "test.text1": "Dies ist eine Test-E-Mail, um zu überprüfen, ob der E-Mailer deines NodeBB korrekt eingestellt wurde.",
"unsub.cta": "Klicke hier, um diese Einstellungen zu ändern.", "unsub.cta": "Klicke hier, um diese Einstellungen zu ändern",
"banned.subject": "Du wurdest von %1 gebannt.", "banned.subject": "Du wurdest von %1 gebannt.",
"banned.text1": "Der Benutzer %1 wurde von %2 gebannt.", "banned.text1": "Der Benutzer %1 wurde von %2 gebannt.",
"banned.text2": "Dieser Bann wird bis %1 dauern.", "banned.text2": "Dieser Bann wird bis %1 dauern.",

@ -9,5 +9,6 @@
"topics_marked_as_read.success": "Topics marked as read!", "topics_marked_as_read.success": "Topics marked as read!",
"all-topics": "All Topics", "all-topics": "All Topics",
"new-topics": "New Topics", "new-topics": "New Topics",
"watched-topics": "Watched Topics" "watched-topics": "Watched Topics",
"unreplied-topics": "Unreplied Topics"
} }

@ -17,27 +17,27 @@
"order.description": "Certain plugins work ideally when they are initialised before/after other plugins.", "order.description": "Certain plugins work ideally when they are initialised before/after other plugins.",
"order.explanation": "Plugins load in the order specified here, from top to bottom", "order.explanation": "Plugins load in the order specified here, from top to bottom",
"plugin-item.themes": "Themes", "plugin-item.themes": "ธีม",
"plugin-item.deactivate": "Deactivate", "plugin-item.deactivate": "ปิดการใช้งาน",
"plugin-item.activate": "Activate", "plugin-item.activate": "เปิดการใช้งาน",
"plugin-item.install": "Install", "plugin-item.install": "ติดตั้ง",
"plugin-item.uninstall": "Uninstall", "plugin-item.uninstall": "ถอนการติดตั้ง",
"plugin-item.settings": "Settings", "plugin-item.settings": "ตั้งค่า",
"plugin-item.installed": "Installed", "plugin-item.installed": "ติดตั้งแล้ว",
"plugin-item.latest": "Latest", "plugin-item.latest": "ล่าสุด",
"plugin-item.upgrade": "Upgrade", "plugin-item.upgrade": "อัพเกรด",
"plugin-item.more-info": "For more information:", "plugin-item.more-info": "ข้อมูลเพิ่มเติม:",
"plugin-item.unknown": "Unknown", "plugin-item.unknown": "ไม่ทราบ",
"plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error.", "plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error.",
"alert.enabled": "Plugin Enabled", "alert.enabled": "Plugin Enabled",
"alert.disabled": "Plugin Disabled", "alert.disabled": "Plugin Disabled",
"alert.upgraded": "Plugin Upgraded", "alert.upgraded": "อัพเกรดปลั๊กอินแล้ว",
"alert.installed": "Plugin Installed", "alert.installed": "ติดตั้งปลั๊กอินแล้ว",
"alert.uninstalled": "Plugin Uninstalled", "alert.uninstalled": "ถอนการติดตั้งปลั๊กอินแล้ว",
"alert.activate-success": "Please restart your NodeBB to fully activate this plugin", "alert.activate-success": "โปรดรีสตาร์ท NodeBB ของคุณเพื่อเปิดการทำงานของธีมนี้",
"alert.deactivate-success": "Plugin successfully deactivated", "alert.deactivate-success": "ปิดการใช้งานปลั๊กอินนี้แล้ว",
"alert.upgrade-success": "Please reload your NodeBB to fully upgrade this plugin", "alert.upgrade-success": "โปรดรีสตาร์ท NodeBB ของคุณเพื่ออัพเกรดปลั๊กอินนี้",
"alert.install-success": "Plugin successfully installed, please activate the plugin.", "alert.install-success": "Plugin successfully installed, please activate the plugin.",
"alert.uninstall-success": "The plugin has been successfully deactivated and uninstalled.", "alert.uninstall-success": "The plugin has been successfully deactivated and uninstalled.",
"alert.suggest-error": "<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class=\"alert alert-danger\"><strong>Server returned (%1)</strong>: %2</div>", "alert.suggest-error": "<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class=\"alert alert-danger\"><strong>Server returned (%1)</strong>: %2</div>",
@ -45,7 +45,7 @@
"alert.incompatible": "<p>Your version of NodeBB (v%1) is only cleared to upgrade to v%2 of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.</p>", "alert.incompatible": "<p>Your version of NodeBB (v%1) is only cleared to upgrade to v%2 of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.</p>",
"alert.possibly-incompatible": "<div class=\"alert alert-warning\"><p><strong>No Compatibility Information Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div><p>In the event that NodeBB cannot boot properly:</p><pre><code>$ ./nodebb reset plugin=\"%1\"</code></pre><p>Continue installation of latest version of this plugin?</p>", "alert.possibly-incompatible": "<div class=\"alert alert-warning\"><p><strong>No Compatibility Information Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div><p>In the event that NodeBB cannot boot properly:</p><pre><code>$ ./nodebb reset plugin=\"%1\"</code></pre><p>Continue installation of latest version of this plugin?</p>",
"license.title": "Plugin License Information", "license.title": "ข้อมูลลิขสิทธิ์ปลั๊กอิน",
"license.intro": "The plugin <strong>%1</strong> is licensed under the %2. Please read and understand the license terms prior to activating this plugin.", "license.intro": "The plugin <strong>%1</strong> is licensed under the %2. Please read and understand the license terms prior to activating this plugin.",
"license.cta": "Do you wish to continue with activating this plugin?" "license.cta": "Do you wish to continue with activating this plugin?"
} }

@ -1,5 +1,5 @@
{ {
"home-page": "Home Page", "home-page": "หน้าแรก",
"description": "Choose what page is shown when users navigate to the root URL of your forum.", "description": "Choose what page is shown when users navigate to the root URL of your forum.",
"home-page-route": "Home Page Route", "home-page-route": "Home Page Route",
"custom-route": "Custom Route", "custom-route": "Custom Route",

@ -1,9 +1,9 @@
{ {
"chat-settings": "Chat Settings", "chat-settings": "ตั้งค่าแชท",
"disable": "Disable chat", "disable": "ปิดการใช้งานแชท",
"disable-editing": "Disable chat message editing/deletion", "disable-editing": "ปิดการแก้ไข และการลบแชท",
"disable-editing-help": "Administrators and global moderators are exempt from this restriction", "disable-editing-help": "Administrators and global moderators are exempt from this restriction",
"max-length": "Maximum length of chat messages", "max-length": "จำนวนอักขระมากที่มากที่สุดต่อแชท",
"max-room-size": "Maximum number of users in chat rooms", "max-room-size": "จำนวนผู้ใช้ในห้องแชทมากที่สุด",
"delay": "Time between chat messages in milliseconds" "delay": "Time between chat messages in milliseconds"
} }

@ -1,10 +1,10 @@
{ {
"invalid-data": "ข้อมูลไม่ถูกต้อง", "invalid-data": "ข้อมูลไม่ถูกต้อง",
"invalid-json": "Invalid JSON", "invalid-json": "รูปแบบ JSON ไม่ถูกต้อง",
"not-logged-in": "คุณยังไม่ได้ลงชื่อเข้าระบบ", "not-logged-in": "คุณยังไม่ได้ลงชื่อเข้าระบบ",
"account-locked": "บัญชีของคุณถูกระงับการใช้งานชั่วคราว", "account-locked": "บัญชีของคุณถูกระงับการใช้งานชั่วคราว",
"search-requires-login": "\"ฟังก์ชั่นการค้นหา\" ต้องการบัญชีผู้ใช้ กรุณาเข้าสู่ระบบหรือสมัครสมาชิก", "search-requires-login": "\"ฟังก์ชั่นการค้นหา\" ต้องการบัญชีผู้ใช้ กรุณาเข้าสู่ระบบหรือสมัครสมาชิก",
"goback": "Press back to return to the previous page", "goback": "กดย้อนกลับเพื่อกลับไปยังหน้าที่แล้ว",
"invalid-cid": "Category ID ไม่ถูกต้อง", "invalid-cid": "Category ID ไม่ถูกต้อง",
"invalid-tid": "Topic ID ไม่ถูกต้อง", "invalid-tid": "Topic ID ไม่ถูกต้อง",
"invalid-pid": "Post ID ไม่ถูกต้อง", "invalid-pid": "Post ID ไม่ถูกต้อง",
@ -14,7 +14,7 @@
"invalid-title": "คำนำหน้าชื่อไม่ถูกต้อง", "invalid-title": "คำนำหน้าชื่อไม่ถูกต้อง",
"invalid-user-data": "User Data ไม่ถูกต้อง", "invalid-user-data": "User Data ไม่ถูกต้อง",
"invalid-password": "รหัสผ่านไม่ถูกต้อง", "invalid-password": "รหัสผ่านไม่ถูกต้อง",
"invalid-login-credentials": "Invalid login credentials", "invalid-login-credentials": "session login หมดอายุ",
"invalid-username-or-password": "กรุณาระบุชื่อผู้ใช้และรหัสผ่าน", "invalid-username-or-password": "กรุณาระบุชื่อผู้ใช้และรหัสผ่าน",
"invalid-search-term": "ข้อความค้นหาไม่ถูกต้อง", "invalid-search-term": "ข้อความค้นหาไม่ถูกต้อง",
"csrf-invalid": "เราไม่สามารถนำท่านเข้าสู่ระบบได้ เหมือนกับว่าเซสชั่นหมดอายุแล้ว กรุณาลองใหม่อีกครั้ง", "csrf-invalid": "เราไม่สามารถนำท่านเข้าสู่ระบบได้ เหมือนกับว่าเซสชั่นหมดอายุแล้ว กรุณาลองใหม่อีกครั้ง",

@ -104,6 +104,6 @@
"cookies.accept": "เข้าใจแล้ว!!! ", "cookies.accept": "เข้าใจแล้ว!!! ",
"cookies.learn_more": "เรียนรู้เพิ่มเติม", "cookies.learn_more": "เรียนรู้เพิ่มเติม",
"edited": "ถูกแก้ไขแล้ว", "edited": "ถูกแก้ไขแล้ว",
"disabled": "Disabled", "disabled": "ปิด",
"select": "Select" "select": "เลือก"
} }

@ -41,7 +41,7 @@
"new_register": "<strong>%1</strong>ได้ส่งคำขอสมัครสมาชิก", "new_register": "<strong>%1</strong>ได้ส่งคำขอสมัครสมาชิก",
"new_register_multiple": "มี<strong>%1</strong>คำขอสมัครสมาชิกที่รอการรีวิว", "new_register_multiple": "มี<strong>%1</strong>คำขอสมัครสมาชิกที่รอการรีวิว",
"flag_assigned_to_you": "<strong>ปักธง %1</strong>ได้ถูกปักธงให้คุณ", "flag_assigned_to_you": "<strong>ปักธง %1</strong>ได้ถูกปักธงให้คุณ",
"post_awaiting_review": "Post awaiting review", "post_awaiting_review": "โพสกำลังรอการพิจารณา",
"email-confirmed": "Email ได้รับการยืนยันแล้ว", "email-confirmed": "Email ได้รับการยืนยันแล้ว",
"email-confirmed-message": "ขอบคุณที่ยืนยัน Email ของคุณ บัญชีของคุณสามารถใช้งานได้แล้ว", "email-confirmed-message": "ขอบคุณที่ยืนยัน Email ของคุณ บัญชีของคุณสามารถใช้งานได้แล้ว",
"email-confirm-error-message": "มีปัญหาในการยืนยัน Email ของคุณ บางทีรหัสไม่ถูกต้องหรือหมดอายุแล้ว", "email-confirm-error-message": "มีปัญหาในการยืนยัน Email ของคุณ บางทีรหัสไม่ถูกต้องหรือหมดอายุแล้ว",

@ -6,10 +6,10 @@
"popular-month": "กระทู้ฮิตเดือนนี้", "popular-month": "กระทู้ฮิตเดือนนี้",
"popular-alltime": "กระทู้ฮิตตลาดกาล", "popular-alltime": "กระทู้ฮิตตลาดกาล",
"recent": "กระทู้ล่าสุด", "recent": "กระทู้ล่าสุด",
"moderator-tools": "Moderator Tools", "moderator-tools": "เครื่องมือผู้ดูแลระบบ",
"flagged-content": "เนื้อหาที่ถูกปักธง", "flagged-content": "เนื้อหาที่ถูกปักธง",
"ip-blacklist": "ไอดีที่ถูกขึ้นบัญชีดำ", "ip-blacklist": "ไอดีที่ถูกขึ้นบัญชีดำ",
"post-queue": "Post Queue", "post-queue": "คิวโพส",
"users/online": "ผู้ใช้ออนไลน์", "users/online": "ผู้ใช้ออนไลน์",
"users/latest": "ผู้ใช้ล่าสุด", "users/latest": "ผู้ใช้ล่าสุด",
"users/sort-posts": "ผู้ใช้ที่โพสต์เยอะที่สุด", "users/sort-posts": "ผู้ใช้ที่โพสต์เยอะที่สุด",

@ -1,7 +1,7 @@
{ {
"success": "สำเร็จ", "success": "สำเร็จ",
"topic-post": "คุณลงข้อความสำเร็จแล้ว", "topic-post": "คุณลงข้อความสำเร็จแล้ว",
"post-queued": "Your post is queued for approval.", "post-queued": "โพสของคุณกำลังรอการอนุมัติ",
"authentication-successful": "การระบุตัวตนสำเร็จแล้ว", "authentication-successful": "การระบุตัวตนสำเร็จแล้ว",
"settings-saved": "การตั้งค่าได้ถูกบันทึกแล้ว" "settings-saved": "การตั้งค่าได้ถูกบันทึกแล้ว"
} }

@ -14,7 +14,7 @@
"quote": "คำอ้างอิง", "quote": "คำอ้างอิง",
"reply": "ตอบ", "reply": "ตอบ",
"replies_to_this_post": " %1 คำตอบ", "replies_to_this_post": " %1 คำตอบ",
"one_reply_to_this_post": "1 Reply", "one_reply_to_this_post": "1 การตอบกลับ",
"last_reply_time": "คำตอบล่าสุด", "last_reply_time": "คำตอบล่าสุด",
"reply-as-topic": "ตอบโดยตั้งกระทู้ใหม่", "reply-as-topic": "ตอบโดยตั้งกระทู้ใหม่",
"guest-login-reply": "เข้าสู่ระบบเพื่อตอบกลับ", "guest-login-reply": "เข้าสู่ระบบเพื่อตอบกลับ",
@ -59,7 +59,7 @@
"thread_tools.unlock": "ปลดล็อคกระทู้", "thread_tools.unlock": "ปลดล็อคกระทู้",
"thread_tools.move": "ย้ายกระทู้", "thread_tools.move": "ย้ายกระทู้",
"thread_tools.move_all": "ย้ายทั้งหมด", "thread_tools.move_all": "ย้ายทั้งหมด",
"thread_tools.select_category": "Select Category", "thread_tools.select_category": "เลือกประเภท",
"thread_tools.fork": "แยกกระทู้", "thread_tools.fork": "แยกกระทู้",
"thread_tools.delete": "ลบกระทู้", "thread_tools.delete": "ลบกระทู้",
"thread_tools.delete-posts": "ลบโพสต์", "thread_tools.delete-posts": "ลบโพสต์",

@ -117,7 +117,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount); updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount);
updatePresenceGraph(data.users); updatePresenceGraph(data.users);
updateTopicsGraph(data.topics); updateTopicsGraph(data.topTenTopics);
$('#active-users').translateHtml(html); $('#active-users').translateHtml(html);
}; };
@ -444,39 +444,36 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
} }
function updateTopicsGraph(topics) { function updateTopicsGraph(topics) {
if (!Object.keys(topics).length) { if (!topics.length) {
topics = { 0: { topics = [{
title: 'No users browsing', title: 'No users browsing',
value: 1, count: 1,
} }; }];
} }
var tids = Object.keys(topics);
graphs.topics.data.labels = []; graphs.topics.data.labels = [];
graphs.topics.data.datasets[0].data = []; graphs.topics.data.datasets[0].data = [];
graphs.topics.data.datasets[0].backgroundColor = []; graphs.topics.data.datasets[0].backgroundColor = [];
graphs.topics.data.datasets[0].hoverBackgroundColor = []; graphs.topics.data.datasets[0].hoverBackgroundColor = [];
for (var i = 0, ii = tids.length; i < ii; i += 1) { topics.forEach(function (topic, i) {
graphs.topics.data.labels.push(topics[tids[i]].title); graphs.topics.data.labels.push(topic.title);
graphs.topics.data.datasets[0].data.push(topics[tids[i]].value); graphs.topics.data.datasets[0].data.push(topic.count);
graphs.topics.data.datasets[0].backgroundColor.push(topicColors[i]); graphs.topics.data.datasets[0].backgroundColor.push(topicColors[i]);
graphs.topics.data.datasets[0].hoverBackgroundColor.push(lighten(topicColors[i], 10)); graphs.topics.data.datasets[0].hoverBackgroundColor.push(lighten(topicColors[i], 10));
} });
function buildTopicsLegend() { function buildTopicsLegend() {
var legend = $('#topics-legend').html(''); var legend = $('#topics-legend').html('');
for (var i = 0, ii = tids.length; i < ii; i += 1) { topics.forEach(function (topic, i) {
var topic = topics[tids[i]]; var label = topic.count === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.title + '</a>';
var label = topic.value === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + tids[i] + '" target="_blank"> ' + topic.title + '</a>';
legend.append('<li>' + legend.append('<li>' +
'<div style="background-color: ' + topicColors[i] + ';"></div>' + '<div style="background-color: ' + topicColors[i] + ';"></div>' +
'<span>' + label + '</span>' + '<span>' + label + '</span>' +
'</li>'); '</li>');
} });
} }
buildTopicsLegend(); buildTopicsLegend();

@ -93,7 +93,7 @@ define('forum/account/header', [
paramValue: ajaxify.data.theirid, paramValue: ajaxify.data.theirid,
accept: '.png,.jpg,.bmp', accept: '.png,.jpg,.bmp',
}, function (imageUrlOnServer) { }, function (imageUrlOnServer) {
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?' + config['cache-buster'] + ')'); components.get('account/cover').css('background-image', 'url(' + config.relative_path + imageUrlOnServer + '?' + config['cache-buster'] + ')');
}); });
}, },
removeCover removeCover

@ -32,6 +32,32 @@ helpers.noScriptErrors = function (req, res, error, httpStatus) {
}); });
}; };
helpers.validFilters = { '': true, new: true, watched: true, unreplied: true };
helpers.buildFilters = function (url, filter) {
return [{
name: '[[unread:all-topics]]',
url: url,
selected: filter === '',
filter: '',
}, {
name: '[[unread:new-topics]]',
url: url + '/new',
selected: filter === 'new',
filter: 'new',
}, {
name: '[[unread:watched-topics]]',
url: url + '/watched',
selected: filter === 'watched',
filter: 'watched',
}, {
name: '[[unread:unreplied-topics]]',
url: url + '/unreplied',
selected: filter === 'unreplied',
filter: 'unreplied',
}];
};
helpers.notAllowed = function (req, res, error) { helpers.notAllowed = function (req, res, error) {
plugins.fireHook('filter:helpers.notAllowed', { plugins.fireHook('filter:helpers.notAllowed', {
req: req, req: req,

@ -1,12 +1,13 @@
'use strict'; 'use strict';
var async = require('async');
var nconf = require('nconf'); var nconf = require('nconf');
var topics = require('../topics'); var topics = require('../topics');
var meta = require('../meta'); var meta = require('../meta');
var helpers = require('./helpers'); var helpers = require('./helpers');
var popularController = {}; var popularController = module.exports;
var anonCache = {}; var anonCache = {};
var lastUpdateTime = 0; var lastUpdateTime = 0;
@ -38,11 +39,11 @@ popularController.get = function (req, res, next) {
} }
} }
topics.getPopular(term, req.uid, meta.config.topicsPerList, function (err, topics) { async.waterfall([
if (err) { function (next) {
return next(err); topics.getPopular(term, req.uid, meta.config.topicsPerList, next);
} },
function (topics) {
var data = { var data = {
topics: topics, topics: topics,
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1, 'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
@ -67,7 +68,6 @@ popularController.get = function (req, res, next) {
} }
res.render('popular', data); res.render('popular', data);
}); },
], next);
}; };
module.exports = popularController;

@ -26,12 +26,12 @@ postsController.redirectToPost = function (req, res, next) {
}, next); }, next);
}, },
function (results, next) { function (results, next) {
if (!results.canRead) {
return helpers.notAllowed(req, res);
}
if (!results.path) { if (!results.path) {
return next(); return next();
} }
if (!results.canRead) {
return helpers.notAllowed(req, res);
}
helpers.redirect(res, results.path); helpers.redirect(res, results.path);
}, },
], next); ], next);

@ -13,8 +13,6 @@ var pagination = require('../pagination');
var recentController = module.exports; var recentController = module.exports;
var validFilter = { '': true, new: true, watched: true };
recentController.get = function (req, res, next) { recentController.get = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1; var page = parseInt(req.query.page, 10) || 1;
var stop = 0; var stop = 0;
@ -23,7 +21,8 @@ recentController.get = function (req, res, next) {
var filter = req.params.filter || ''; var filter = req.params.filter || '';
var categoryData; var categoryData;
var rssToken; var rssToken;
if (!validFilter[filter]) {
if (!helpers.validFilters[filter]) {
return next(); return next();
} }
@ -62,22 +61,7 @@ recentController.get = function (req, res, next) {
data.rssFeedUrl += '?uid=' + req.uid + '&token=' + rssToken; data.rssFeedUrl += '?uid=' + req.uid + '&token=' + rssToken;
} }
data.title = '[[pages:recent]]'; data.title = '[[pages:recent]]';
data.filters = [{ data.filters = helpers.buildFilters('recent', filter);
name: '[[unread:all-topics]]',
url: 'recent',
selected: filter === '',
filter: '',
}, {
name: '[[unread:new-topics]]',
url: 'recent/new',
selected: filter === 'new',
filter: 'new',
}, {
name: '[[unread:watched-topics]]',
url: 'recent/watched',
selected: filter === 'watched',
filter: 'watched',
}];
data.selectedFilter = data.filters.find(function (filter) { data.selectedFilter = data.filters.find(function (filter) {
return filter && filter.selected; return filter && filter.selected;

@ -13,8 +13,6 @@ var helpers = require('./helpers');
var unreadController = module.exports; var unreadController = module.exports;
var validFilter = { '': true, new: true, watched: true };
unreadController.get = function (req, res, next) { unreadController.get = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1; var page = parseInt(req.query.page, 10) || 1;
var results; var results;
@ -24,7 +22,7 @@ unreadController.get = function (req, res, next) {
async.waterfall([ async.waterfall([
function (next) { function (next) {
plugins.fireHook('filter:unread.getValidFilters', { filters: validFilter }, next); plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
}, },
function (data, _next) { function (data, _next) {
if (!data.filters[filter]) { if (!data.filters[filter]) {
@ -72,22 +70,7 @@ unreadController.get = function (req, res, next) {
} }
data.title = '[[pages:unread]]'; data.title = '[[pages:unread]]';
data.filters = [{ data.filters = helpers.buildFilters('unread', filter);
name: '[[unread:all-topics]]',
url: 'unread',
selected: filter === '',
filter: '',
}, {
name: '[[unread:new-topics]]',
url: 'unread/new',
selected: filter === 'new',
filter: 'new',
}, {
name: '[[unread:watched-topics]]',
url: 'unread/watched',
selected: filter === 'watched',
filter: 'watched',
}];
data.selectedFilter = data.filters.find(function (filter) { data.selectedFilter = data.filters.find(function (filter) {
return filter && filter.selected; return filter && filter.selected;
@ -105,10 +88,10 @@ unreadController.unreadTotal = function (req, res, next) {
async.waterfall([ async.waterfall([
function (next) { function (next) {
plugins.fireHook('filter:unread.getValidFilters', { filters: validFilter }, next); plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
}, },
function (data, _next) { function (data, _next) {
if (!validFilter[filter]) { if (!data.filters[filter]) {
return next(); return next();
} }
topics.getTotalUnread(req.uid, filter, _next); topics.getTotalUnread(req.uid, filter, _next);

@ -442,7 +442,7 @@ function enableDefaultPlugins(next) {
'nodebb-plugin-emoji-extended', 'nodebb-plugin-emoji-extended',
'nodebb-plugin-emoji-one', 'nodebb-plugin-emoji-one',
]; ];
var customDefaults = nconf.get('defaultPlugins'); var customDefaults = nconf.get('defaultplugins') || nconf.get('defaultPlugins');
winston.info('[install/defaultPlugins] customDefaults', customDefaults); winston.info('[install/defaultPlugins] customDefaults', customDefaults);

@ -7,10 +7,6 @@ var async = require('async');
var Languages = module.exports; var Languages = module.exports;
var languagesPath = path.join(__dirname, '../build/public/language'); var languagesPath = path.join(__dirname, '../build/public/language');
Languages.init = function (next) {
next();
};
Languages.get = function (language, namespace, callback) { Languages.get = function (language, namespace, callback) {
fs.readFile(path.join(languagesPath, language, namespace + '.json'), { encoding: 'utf-8' }, function (err, data) { fs.readFile(path.join(languagesPath, language, namespace + '.json'), { encoding: 'utf-8' }, function (err, data) {
if (err) { if (err) {

@ -89,7 +89,7 @@ SocketRooms.getAll = function (socket, data, callback) {
var topTenTopics = []; var topTenTopics = [];
Object.keys(totals.topics).forEach(function (tid) { Object.keys(totals.topics).forEach(function (tid) {
topTenTopics.push({ tid: tid, count: totals.topics[tid].count }); topTenTopics.push({ tid: tid, count: totals.topics[tid].count || 0 });
}); });
topTenTopics = topTenTopics.sort(function (a, b) { topTenTopics = topTenTopics.sort(function (a, b) {
@ -105,13 +105,11 @@ SocketRooms.getAll = function (socket, data, callback) {
topics.getTopicsFields(topTenTids, ['title'], next); topics.getTopicsFields(topTenTids, ['title'], next);
}, },
function (titles, next) { function (titles, next) {
totals.topics = {}; totals.topTenTopics = topTenTopics.map(function (topic, index) {
topTenTopics.forEach(function (topic, index) { topic.title = titles[index].title;
totals.topics[topic.tid] = { return topic;
value: topic.count || 0,
title: String(titles[index].title),
};
}); });
next(null, totals); next(null, totals);
}, },
], callback); ], callback);

@ -61,6 +61,8 @@ module.exports = function (Topics) {
Topics.filterWatchedTids(tids, uid, next); Topics.filterWatchedTids(tids, uid, next);
} else if (filter === 'new') { } else if (filter === 'new') {
Topics.filterNewTids(tids, uid, next); Topics.filterNewTids(tids, uid, next);
} else if (filter === 'unreplied') {
Topics.filterUnrepliedTids(tids, next);
} else { } else {
Topics.filterNotIgnoredTids(tids, uid, next); Topics.filterNotIgnoredTids(tids, uid, next);
} }

@ -125,6 +125,8 @@ module.exports = function (Topics) {
if (params.filter === 'watched') { if (params.filter === 'watched') {
Topics.filterWatchedTids(tids, uid, next); Topics.filterWatchedTids(tids, uid, next);
} else if (params.filter === 'unreplied') {
Topics.filterUnrepliedTids(tids, next);
} else { } else {
next(null, tids); next(null, tids);
} }
@ -390,4 +392,18 @@ module.exports = function (Topics) {
}, },
], callback); ], callback);
}; };
Topics.filterUnrepliedTids = function (tids, callback) {
async.waterfall([
function (next) {
db.sortedSetScores('topics:posts', tids, next);
},
function (scores, next) {
tids = tids.filter(function (tid, index) {
return tid && scores[index] <= 1;
});
next(null, tids);
},
], callback);
};
}; };

@ -105,7 +105,6 @@ function initializeNodeBB(callback) {
function (next) { function (next) {
async.series([ async.series([
meta.sounds.addUploads, meta.sounds.addUploads,
languages.init,
meta.blacklist.load, meta.blacklist.load,
flags.init, flags.init,
], next); ], next);

@ -379,7 +379,6 @@ describe('socket.io', function () {
assert(data.hasOwnProperty('socketCount')); assert(data.hasOwnProperty('socketCount'));
assert(data.hasOwnProperty('topics')); assert(data.hasOwnProperty('topics'));
assert(data.hasOwnProperty('users')); assert(data.hasOwnProperty('users'));
assert.equal(data.topics['1'].title, 'test topic title');
done(); done();
}); });
}, 1000); }, 1000);

@ -6,8 +6,6 @@ var shim = require('../public/src/modules/translator.js');
var Translator = shim.Translator; var Translator = shim.Translator;
var db = require('./mocks/databasemock'); var db = require('./mocks/databasemock');
require('../src/languages').init(function () {});
describe('Translator shim', function () { describe('Translator shim', function () {
describe('.translate()', function () { describe('.translate()', function () {
it('should translate correctly', function (done) { it('should translate correctly', function (done) {

Loading…
Cancel
Save