mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 11:31:23 +01:00
Merge remote-tracking branch 'refs/remotes/origin/master' into develop
# Conflicts: # package.json
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
"nodebb-plugin-emoji-extended": "1.1.1",
|
||||
"nodebb-plugin-emoji-one": "1.2.1",
|
||||
"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-spam-be-gone": "0.5.1",
|
||||
"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.host": "SMTP Host",
|
||||
"smtp-transport.port": "SMTP Port",
|
||||
"smtp-transport.security": "Connection security",
|
||||
"smtp-transport.security-encrypted": "Encrypted",
|
||||
"smtp-transport.security": "Verbindungssicherheit",
|
||||
"smtp-transport.security-encrypted": "Verschlüsselt",
|
||||
"smtp-transport.security-starttls": "StartTLS",
|
||||
"smtp-transport.security-none": "None",
|
||||
"smtp-transport.security-none": "Keine",
|
||||
"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.password": "Passwort",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"notif.post.cta": "Hier klicken, um das gesamte Thema zu lesen",
|
||||
"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.",
|
||||
"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.text1": "Der Benutzer %1 wurde von %2 gebannt.",
|
||||
"banned.text2": "Dieser Bann wird bis %1 dauern.",
|
||||
|
||||
@@ -9,5 +9,6 @@
|
||||
"topics_marked_as_read.success": "Topics marked as read!",
|
||||
"all-topics": "All 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.explanation": "Plugins load in the order specified here, from top to bottom",
|
||||
|
||||
"plugin-item.themes": "Themes",
|
||||
"plugin-item.deactivate": "Deactivate",
|
||||
"plugin-item.activate": "Activate",
|
||||
"plugin-item.install": "Install",
|
||||
"plugin-item.uninstall": "Uninstall",
|
||||
"plugin-item.settings": "Settings",
|
||||
"plugin-item.installed": "Installed",
|
||||
"plugin-item.latest": "Latest",
|
||||
"plugin-item.upgrade": "Upgrade",
|
||||
"plugin-item.more-info": "For more information:",
|
||||
"plugin-item.unknown": "Unknown",
|
||||
"plugin-item.themes": "ธีม",
|
||||
"plugin-item.deactivate": "ปิดการใช้งาน",
|
||||
"plugin-item.activate": "เปิดการใช้งาน",
|
||||
"plugin-item.install": "ติดตั้ง",
|
||||
"plugin-item.uninstall": "ถอนการติดตั้ง",
|
||||
"plugin-item.settings": "ตั้งค่า",
|
||||
"plugin-item.installed": "ติดตั้งแล้ว",
|
||||
"plugin-item.latest": "ล่าสุด",
|
||||
"plugin-item.upgrade": "อัพเกรด",
|
||||
"plugin-item.more-info": "ข้อมูลเพิ่มเติม:",
|
||||
"plugin-item.unknown": "ไม่ทราบ",
|
||||
"plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error.",
|
||||
|
||||
"alert.enabled": "Plugin Enabled",
|
||||
"alert.disabled": "Plugin Disabled",
|
||||
"alert.upgraded": "Plugin Upgraded",
|
||||
"alert.installed": "Plugin Installed",
|
||||
"alert.uninstalled": "Plugin Uninstalled",
|
||||
"alert.activate-success": "Please restart your NodeBB to fully activate this plugin",
|
||||
"alert.deactivate-success": "Plugin successfully deactivated",
|
||||
"alert.upgrade-success": "Please reload your NodeBB to fully upgrade this plugin",
|
||||
"alert.upgraded": "อัพเกรดปลั๊กอินแล้ว",
|
||||
"alert.installed": "ติดตั้งปลั๊กอินแล้ว",
|
||||
"alert.uninstalled": "ถอนการติดตั้งปลั๊กอินแล้ว",
|
||||
"alert.activate-success": "โปรดรีสตาร์ท NodeBB ของคุณเพื่อเปิดการทำงานของธีมนี้",
|
||||
"alert.deactivate-success": "ปิดการใช้งานปลั๊กอินนี้แล้ว",
|
||||
"alert.upgrade-success": "โปรดรีสตาร์ท NodeBB ของคุณเพื่ออัพเกรดปลั๊กอินนี้",
|
||||
"alert.install-success": "Plugin successfully installed, please activate the plugin.",
|
||||
"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>",
|
||||
@@ -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.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.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.",
|
||||
"home-page-route": "Home Page Route",
|
||||
"custom-route": "Custom Route",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"chat-settings": "Chat Settings",
|
||||
"disable": "Disable chat",
|
||||
"disable-editing": "Disable chat message editing/deletion",
|
||||
"chat-settings": "ตั้งค่าแชท",
|
||||
"disable": "ปิดการใช้งานแชท",
|
||||
"disable-editing": "ปิดการแก้ไข และการลบแชท",
|
||||
"disable-editing-help": "Administrators and global moderators are exempt from this restriction",
|
||||
"max-length": "Maximum length of chat messages",
|
||||
"max-room-size": "Maximum number of users in chat rooms",
|
||||
"max-length": "จำนวนอักขระมากที่มากที่สุดต่อแชท",
|
||||
"max-room-size": "จำนวนผู้ใช้ในห้องแชทมากที่สุด",
|
||||
"delay": "Time between chat messages in milliseconds"
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"invalid-data": "ข้อมูลไม่ถูกต้อง",
|
||||
"invalid-json": "Invalid JSON",
|
||||
"invalid-json": "รูปแบบ JSON ไม่ถูกต้อง",
|
||||
"not-logged-in": "คุณยังไม่ได้ลงชื่อเข้าระบบ",
|
||||
"account-locked": "บัญชีของคุณถูกระงับการใช้งานชั่วคราว",
|
||||
"search-requires-login": "\"ฟังก์ชั่นการค้นหา\" ต้องการบัญชีผู้ใช้ กรุณาเข้าสู่ระบบหรือสมัครสมาชิก",
|
||||
"goback": "Press back to return to the previous page",
|
||||
"goback": "กดย้อนกลับเพื่อกลับไปยังหน้าที่แล้ว",
|
||||
"invalid-cid": "Category ID ไม่ถูกต้อง",
|
||||
"invalid-tid": "Topic ID ไม่ถูกต้อง",
|
||||
"invalid-pid": "Post ID ไม่ถูกต้อง",
|
||||
@@ -14,7 +14,7 @@
|
||||
"invalid-title": "คำนำหน้าชื่อไม่ถูกต้อง",
|
||||
"invalid-user-data": "User Data ไม่ถูกต้อง",
|
||||
"invalid-password": "รหัสผ่านไม่ถูกต้อง",
|
||||
"invalid-login-credentials": "Invalid login credentials",
|
||||
"invalid-login-credentials": "session login หมดอายุ",
|
||||
"invalid-username-or-password": "กรุณาระบุชื่อผู้ใช้และรหัสผ่าน",
|
||||
"invalid-search-term": "ข้อความค้นหาไม่ถูกต้อง",
|
||||
"csrf-invalid": "เราไม่สามารถนำท่านเข้าสู่ระบบได้ เหมือนกับว่าเซสชั่นหมดอายุแล้ว กรุณาลองใหม่อีกครั้ง",
|
||||
|
||||
@@ -104,6 +104,6 @@
|
||||
"cookies.accept": "เข้าใจแล้ว!!! ",
|
||||
"cookies.learn_more": "เรียนรู้เพิ่มเติม",
|
||||
"edited": "ถูกแก้ไขแล้ว",
|
||||
"disabled": "Disabled",
|
||||
"select": "Select"
|
||||
"disabled": "ปิด",
|
||||
"select": "เลือก"
|
||||
}
|
||||
@@ -41,7 +41,7 @@
|
||||
"new_register": "<strong>%1</strong>ได้ส่งคำขอสมัครสมาชิก",
|
||||
"new_register_multiple": "มี<strong>%1</strong>คำขอสมัครสมาชิกที่รอการรีวิว",
|
||||
"flag_assigned_to_you": "<strong>ปักธง %1</strong>ได้ถูกปักธงให้คุณ",
|
||||
"post_awaiting_review": "Post awaiting review",
|
||||
"post_awaiting_review": "โพสกำลังรอการพิจารณา",
|
||||
"email-confirmed": "Email ได้รับการยืนยันแล้ว",
|
||||
"email-confirmed-message": "ขอบคุณที่ยืนยัน Email ของคุณ บัญชีของคุณสามารถใช้งานได้แล้ว",
|
||||
"email-confirm-error-message": "มีปัญหาในการยืนยัน Email ของคุณ บางทีรหัสไม่ถูกต้องหรือหมดอายุแล้ว",
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
"popular-month": "กระทู้ฮิตเดือนนี้",
|
||||
"popular-alltime": "กระทู้ฮิตตลาดกาล",
|
||||
"recent": "กระทู้ล่าสุด",
|
||||
"moderator-tools": "Moderator Tools",
|
||||
"moderator-tools": "เครื่องมือผู้ดูแลระบบ",
|
||||
"flagged-content": "เนื้อหาที่ถูกปักธง",
|
||||
"ip-blacklist": "ไอดีที่ถูกขึ้นบัญชีดำ",
|
||||
"post-queue": "Post Queue",
|
||||
"post-queue": "คิวโพส",
|
||||
"users/online": "ผู้ใช้ออนไลน์",
|
||||
"users/latest": "ผู้ใช้ล่าสุด",
|
||||
"users/sort-posts": "ผู้ใช้ที่โพสต์เยอะที่สุด",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"success": "สำเร็จ",
|
||||
"topic-post": "คุณลงข้อความสำเร็จแล้ว",
|
||||
"post-queued": "Your post is queued for approval.",
|
||||
"post-queued": "โพสของคุณกำลังรอการอนุมัติ",
|
||||
"authentication-successful": "การระบุตัวตนสำเร็จแล้ว",
|
||||
"settings-saved": "การตั้งค่าได้ถูกบันทึกแล้ว"
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
"quote": "คำอ้างอิง",
|
||||
"reply": "ตอบ",
|
||||
"replies_to_this_post": " %1 คำตอบ",
|
||||
"one_reply_to_this_post": "1 Reply",
|
||||
"one_reply_to_this_post": "1 การตอบกลับ",
|
||||
"last_reply_time": "คำตอบล่าสุด",
|
||||
"reply-as-topic": "ตอบโดยตั้งกระทู้ใหม่",
|
||||
"guest-login-reply": "เข้าสู่ระบบเพื่อตอบกลับ",
|
||||
@@ -59,7 +59,7 @@
|
||||
"thread_tools.unlock": "ปลดล็อคกระทู้",
|
||||
"thread_tools.move": "ย้ายกระทู้",
|
||||
"thread_tools.move_all": "ย้ายทั้งหมด",
|
||||
"thread_tools.select_category": "Select Category",
|
||||
"thread_tools.select_category": "เลือกประเภท",
|
||||
"thread_tools.fork": "แยกกระทู้",
|
||||
"thread_tools.delete": "ลบกระทู้",
|
||||
"thread_tools.delete-posts": "ลบโพสต์",
|
||||
|
||||
@@ -117,7 +117,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
|
||||
|
||||
updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount);
|
||||
updatePresenceGraph(data.users);
|
||||
updateTopicsGraph(data.topics);
|
||||
updateTopicsGraph(data.topTenTopics);
|
||||
|
||||
$('#active-users').translateHtml(html);
|
||||
};
|
||||
@@ -444,39 +444,36 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
|
||||
}
|
||||
|
||||
function updateTopicsGraph(topics) {
|
||||
if (!Object.keys(topics).length) {
|
||||
topics = { 0: {
|
||||
if (!topics.length) {
|
||||
topics = [{
|
||||
title: 'No users browsing',
|
||||
value: 1,
|
||||
} };
|
||||
count: 1,
|
||||
}];
|
||||
}
|
||||
|
||||
var tids = Object.keys(topics);
|
||||
|
||||
graphs.topics.data.labels = [];
|
||||
graphs.topics.data.datasets[0].data = [];
|
||||
graphs.topics.data.datasets[0].backgroundColor = [];
|
||||
graphs.topics.data.datasets[0].hoverBackgroundColor = [];
|
||||
|
||||
for (var i = 0, ii = tids.length; i < ii; i += 1) {
|
||||
graphs.topics.data.labels.push(topics[tids[i]].title);
|
||||
graphs.topics.data.datasets[0].data.push(topics[tids[i]].value);
|
||||
topics.forEach(function (topic, i) {
|
||||
graphs.topics.data.labels.push(topic.title);
|
||||
graphs.topics.data.datasets[0].data.push(topic.count);
|
||||
graphs.topics.data.datasets[0].backgroundColor.push(topicColors[i]);
|
||||
graphs.topics.data.datasets[0].hoverBackgroundColor.push(lighten(topicColors[i], 10));
|
||||
}
|
||||
});
|
||||
|
||||
function buildTopicsLegend() {
|
||||
var legend = $('#topics-legend').html('');
|
||||
|
||||
for (var i = 0, ii = tids.length; i < ii; i += 1) {
|
||||
var topic = topics[tids[i]];
|
||||
var label = topic.value === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + tids[i] + '" target="_blank"> ' + topic.title + '</a>';
|
||||
topics.forEach(function (topic, i) {
|
||||
var label = topic.count === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.title + '</a>';
|
||||
|
||||
legend.append('<li>' +
|
||||
'<div style="background-color: ' + topicColors[i] + ';"></div>' +
|
||||
'<span>' + label + '</span>' +
|
||||
'</li>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
buildTopicsLegend();
|
||||
|
||||
@@ -93,7 +93,7 @@ define('forum/account/header', [
|
||||
paramValue: ajaxify.data.theirid,
|
||||
accept: '.png,.jpg,.bmp',
|
||||
}, 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
|
||||
|
||||
@@ -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) {
|
||||
plugins.fireHook('filter:helpers.notAllowed', {
|
||||
req: req,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var async = require('async');
|
||||
var nconf = require('nconf');
|
||||
var topics = require('../topics');
|
||||
var meta = require('../meta');
|
||||
var helpers = require('./helpers');
|
||||
|
||||
var popularController = {};
|
||||
var popularController = module.exports;
|
||||
|
||||
var anonCache = {};
|
||||
var lastUpdateTime = 0;
|
||||
@@ -38,36 +39,35 @@ popularController.get = function (req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
topics.getPopular(term, req.uid, meta.config.topicsPerList, function (err, topics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
topics.getPopular(term, req.uid, meta.config.topicsPerList, next);
|
||||
},
|
||||
function (topics) {
|
||||
var data = {
|
||||
topics: topics,
|
||||
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
|
||||
rssFeedUrl: nconf.get('relative_path') + '/popular/' + (req.params.term || 'daily') + '.rss',
|
||||
title: '[[pages:popular-' + term + ']]',
|
||||
term: term,
|
||||
};
|
||||
|
||||
var data = {
|
||||
topics: topics,
|
||||
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
|
||||
rssFeedUrl: nconf.get('relative_path') + '/popular/' + (req.params.term || 'daily') + '.rss',
|
||||
title: '[[pages:popular-' + term + ']]',
|
||||
term: term,
|
||||
};
|
||||
if (req.path.startsWith('/api/popular') || req.path.startsWith('/popular')) {
|
||||
var breadcrumbs = [{ text: termToBreadcrumb[term] }];
|
||||
|
||||
if (req.path.startsWith('/api/popular') || req.path.startsWith('/popular')) {
|
||||
var breadcrumbs = [{ text: termToBreadcrumb[term] }];
|
||||
if (req.params.term) {
|
||||
breadcrumbs.unshift({ text: '[[global:header.popular]]', url: '/popular' });
|
||||
}
|
||||
|
||||
if (req.params.term) {
|
||||
breadcrumbs.unshift({ text: '[[global:header.popular]]', url: '/popular' });
|
||||
data.breadcrumbs = helpers.buildBreadcrumbs(breadcrumbs);
|
||||
}
|
||||
|
||||
data.breadcrumbs = helpers.buildBreadcrumbs(breadcrumbs);
|
||||
}
|
||||
if (!req.uid) {
|
||||
anonCache[term] = data;
|
||||
lastUpdateTime = Date.now();
|
||||
}
|
||||
|
||||
if (!req.uid) {
|
||||
anonCache[term] = data;
|
||||
lastUpdateTime = Date.now();
|
||||
}
|
||||
|
||||
res.render('popular', data);
|
||||
});
|
||||
res.render('popular', data);
|
||||
},
|
||||
], next);
|
||||
};
|
||||
|
||||
module.exports = popularController;
|
||||
|
||||
@@ -26,12 +26,12 @@ postsController.redirectToPost = function (req, res, next) {
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
if (!results.canRead) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
if (!results.path) {
|
||||
return next();
|
||||
}
|
||||
if (!results.canRead) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
helpers.redirect(res, results.path);
|
||||
},
|
||||
], next);
|
||||
|
||||
@@ -13,8 +13,6 @@ var pagination = require('../pagination');
|
||||
|
||||
var recentController = module.exports;
|
||||
|
||||
var validFilter = { '': true, new: true, watched: true };
|
||||
|
||||
recentController.get = function (req, res, next) {
|
||||
var page = parseInt(req.query.page, 10) || 1;
|
||||
var stop = 0;
|
||||
@@ -23,7 +21,8 @@ recentController.get = function (req, res, next) {
|
||||
var filter = req.params.filter || '';
|
||||
var categoryData;
|
||||
var rssToken;
|
||||
if (!validFilter[filter]) {
|
||||
|
||||
if (!helpers.validFilters[filter]) {
|
||||
return next();
|
||||
}
|
||||
|
||||
@@ -62,22 +61,7 @@ recentController.get = function (req, res, next) {
|
||||
data.rssFeedUrl += '?uid=' + req.uid + '&token=' + rssToken;
|
||||
}
|
||||
data.title = '[[pages:recent]]';
|
||||
data.filters = [{
|
||||
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.filters = helpers.buildFilters('recent', filter);
|
||||
|
||||
data.selectedFilter = data.filters.find(function (filter) {
|
||||
return filter && filter.selected;
|
||||
|
||||
@@ -13,8 +13,6 @@ var helpers = require('./helpers');
|
||||
|
||||
var unreadController = module.exports;
|
||||
|
||||
var validFilter = { '': true, new: true, watched: true };
|
||||
|
||||
unreadController.get = function (req, res, next) {
|
||||
var page = parseInt(req.query.page, 10) || 1;
|
||||
var results;
|
||||
@@ -24,7 +22,7 @@ unreadController.get = function (req, res, next) {
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
plugins.fireHook('filter:unread.getValidFilters', { filters: validFilter }, next);
|
||||
plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
|
||||
},
|
||||
function (data, _next) {
|
||||
if (!data.filters[filter]) {
|
||||
@@ -72,22 +70,7 @@ unreadController.get = function (req, res, next) {
|
||||
}
|
||||
|
||||
data.title = '[[pages:unread]]';
|
||||
data.filters = [{
|
||||
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.filters = helpers.buildFilters('unread', filter);
|
||||
|
||||
data.selectedFilter = data.filters.find(function (filter) {
|
||||
return filter && filter.selected;
|
||||
@@ -105,10 +88,10 @@ unreadController.unreadTotal = function (req, res, next) {
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
plugins.fireHook('filter:unread.getValidFilters', { filters: validFilter }, next);
|
||||
plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
|
||||
},
|
||||
function (data, _next) {
|
||||
if (!validFilter[filter]) {
|
||||
if (!data.filters[filter]) {
|
||||
return next();
|
||||
}
|
||||
topics.getTotalUnread(req.uid, filter, _next);
|
||||
|
||||
@@ -442,7 +442,7 @@ function enableDefaultPlugins(next) {
|
||||
'nodebb-plugin-emoji-extended',
|
||||
'nodebb-plugin-emoji-one',
|
||||
];
|
||||
var customDefaults = nconf.get('defaultPlugins');
|
||||
var customDefaults = nconf.get('defaultplugins') || nconf.get('defaultPlugins');
|
||||
|
||||
winston.info('[install/defaultPlugins] customDefaults', customDefaults);
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ var async = require('async');
|
||||
var Languages = module.exports;
|
||||
var languagesPath = path.join(__dirname, '../build/public/language');
|
||||
|
||||
Languages.init = function (next) {
|
||||
next();
|
||||
};
|
||||
|
||||
Languages.get = function (language, namespace, callback) {
|
||||
fs.readFile(path.join(languagesPath, language, namespace + '.json'), { encoding: 'utf-8' }, function (err, data) {
|
||||
if (err) {
|
||||
|
||||
@@ -89,7 +89,7 @@ SocketRooms.getAll = function (socket, data, callback) {
|
||||
|
||||
var topTenTopics = [];
|
||||
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) {
|
||||
@@ -105,13 +105,11 @@ SocketRooms.getAll = function (socket, data, callback) {
|
||||
topics.getTopicsFields(topTenTids, ['title'], next);
|
||||
},
|
||||
function (titles, next) {
|
||||
totals.topics = {};
|
||||
topTenTopics.forEach(function (topic, index) {
|
||||
totals.topics[topic.tid] = {
|
||||
value: topic.count || 0,
|
||||
title: String(titles[index].title),
|
||||
};
|
||||
totals.topTenTopics = topTenTopics.map(function (topic, index) {
|
||||
topic.title = titles[index].title;
|
||||
return topic;
|
||||
});
|
||||
|
||||
next(null, totals);
|
||||
},
|
||||
], callback);
|
||||
|
||||
@@ -61,6 +61,8 @@ module.exports = function (Topics) {
|
||||
Topics.filterWatchedTids(tids, uid, next);
|
||||
} else if (filter === 'new') {
|
||||
Topics.filterNewTids(tids, uid, next);
|
||||
} else if (filter === 'unreplied') {
|
||||
Topics.filterUnrepliedTids(tids, next);
|
||||
} else {
|
||||
Topics.filterNotIgnoredTids(tids, uid, next);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ module.exports = function (Topics) {
|
||||
|
||||
if (params.filter === 'watched') {
|
||||
Topics.filterWatchedTids(tids, uid, next);
|
||||
} else if (params.filter === 'unreplied') {
|
||||
Topics.filterUnrepliedTids(tids, next);
|
||||
} else {
|
||||
next(null, tids);
|
||||
}
|
||||
@@ -390,4 +392,18 @@ module.exports = function (Topics) {
|
||||
},
|
||||
], 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) {
|
||||
async.series([
|
||||
meta.sounds.addUploads,
|
||||
languages.init,
|
||||
meta.blacklist.load,
|
||||
flags.init,
|
||||
], next);
|
||||
|
||||
@@ -379,7 +379,6 @@ describe('socket.io', function () {
|
||||
assert(data.hasOwnProperty('socketCount'));
|
||||
assert(data.hasOwnProperty('topics'));
|
||||
assert(data.hasOwnProperty('users'));
|
||||
assert.equal(data.topics['1'].title, 'test topic title');
|
||||
done();
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
@@ -6,8 +6,6 @@ var shim = require('../public/src/modules/translator.js');
|
||||
var Translator = shim.Translator;
|
||||
var db = require('./mocks/databasemock');
|
||||
|
||||
require('../src/languages').init(function () {});
|
||||
|
||||
describe('Translator shim', function () {
|
||||
describe('.translate()', function () {
|
||||
it('should translate correctly', function (done) {
|
||||
|
||||
Reference in New Issue
Block a user