mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
Merge remote-tracking branch 'origin/master' into hashtalk
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var user = require('../user'),
|
var winston = require('winston'),
|
||||||
|
user = require('../user'),
|
||||||
translator = require('../../public/src/translator');
|
translator = require('../../public/src/translator');
|
||||||
|
|
||||||
module.exports = function(Meta) {
|
module.exports = function(Meta) {
|
||||||
@@ -14,7 +15,14 @@ module.exports = function(Meta) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Meta.title.build = function (urlFragment, language, callback) {
|
Meta.title.build = function (urlFragment, language, callback) {
|
||||||
Meta.title.parseFragment(decodeURIComponent(urlFragment), language, function(err, title) {
|
var uri = '';
|
||||||
|
try {
|
||||||
|
uri = decodeURIComponent(urlFragment);
|
||||||
|
} catch(e) {
|
||||||
|
winston.error('Invalid url fragment : ' + urlFragment, e.stack);
|
||||||
|
return callback(null, Meta.config.browserTitle || 'NodeBB');
|
||||||
|
}
|
||||||
|
Meta.title.parseFragment(uri, language, function(err, title) {
|
||||||
if (err) {
|
if (err) {
|
||||||
title = Meta.config.browserTitle || 'NodeBB';
|
title = Meta.config.browserTitle || 'NodeBB';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ var async = require('async'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
posts = posts.filter(function(post) {
|
posts = posts.filter(function(post) {
|
||||||
return parseInt(results.topics[post.tid].deleted, 10) !== 1;
|
return results.topics[post.tid] && parseInt(results.topics[post.tid].deleted, 10) !== 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
async.map(posts, function(post, next) {
|
async.map(posts, function(post, next) {
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ var async = require('async'),
|
|||||||
Topics.getTopicsData(tids, function(err, topics) {
|
Topics.getTopicsData(tids, function(err, topics) {
|
||||||
function mapFilter(array, field) {
|
function mapFilter(array, field) {
|
||||||
return array.map(function(topic) {
|
return array.map(function(topic) {
|
||||||
return topic[field];
|
return topic && topic[field];
|
||||||
}).filter(function(value, index, array) {
|
}).filter(function(value, index, array) {
|
||||||
return array.indexOf(value) === index;
|
return value && array.indexOf(value) === index;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +219,7 @@ var async = require('async'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (var i=0; i<topics.length; ++i) {
|
for (var i=0; i<topics.length; ++i) {
|
||||||
|
if (topics[i]) {
|
||||||
topics[i].category = categories[topics[i].cid];
|
topics[i].category = categories[topics[i].cid];
|
||||||
topics[i].category.disabled = parseInt(topics[i].category.disabled, 10) === 1;
|
topics[i].category.disabled = parseInt(topics[i].category.disabled, 10) === 1;
|
||||||
topics[i].user = users[topics[i].uid];
|
topics[i].user = users[topics[i].uid];
|
||||||
@@ -231,9 +232,10 @@ var async = require('async'),
|
|||||||
topics[i].unread = !(results.hasRead[i] && parseInt(uid, 10) !== 0);
|
topics[i].unread = !(results.hasRead[i] && parseInt(uid, 10) !== 0);
|
||||||
topics[i].unreplied = parseInt(topics[i].postcount, 10) <= 1;
|
topics[i].unreplied = parseInt(topics[i].postcount, 10) <= 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
topics = topics.filter(function(topic) {
|
topics = topics.filter(function(topic) {
|
||||||
return !topic.category.disabled &&
|
return topic && !topic.category.disabled &&
|
||||||
(!topic.deleted || (topic.deleted && isAdminOrMod[topic.cid]) ||
|
(!topic.deleted || (topic.deleted && isAdminOrMod[topic.cid]) ||
|
||||||
parseInt(topic.uid, 10) === parseInt(uid, 10));
|
parseInt(topic.uid, 10) === parseInt(uid, 10));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user