Merge branch 'master' into 0.5.1

v1.18.x
Julian Lam 11 years ago
commit 101288c75c

@ -3,6 +3,10 @@
"field": "title", "field": "title",
"value": "NodeBB" "value": "NodeBB"
}, },
{
"field": "showSiteTitle",
"value": "1"
},
{ {
"field": "postDelay", "field": "postDelay",
"value": 10 "value": 10

@ -2,7 +2,7 @@
"name": "nodebb", "name": "nodebb",
"license": "GPLv3 or later", "license": "GPLv3 or later",
"description": "NodeBB Forum", "description": "NodeBB Forum",
"version": "0.5.0-4", "version": "0.5.0",
"homepage": "http://www.nodebb.org", "homepage": "http://www.nodebb.org",
"repository": { "repository": {
"type": "git", "type": "git",

@ -1,7 +1,7 @@
"use strict"; "use strict";
/*global define, ajaxify, app, socket, RELATIVE_PATH*/ /*global define, ajaxify, app, socket, RELATIVE_PATH*/
define('forum/admin/index', function() { define('forum/admin/index', ['semver'], function(semver) {
var Admin = {}; var Admin = {};
Admin.init = function() { Admin.init = function() {
@ -21,6 +21,13 @@ define('forum/admin/index', function() {
}); });
$.get('https://api.github.com/repos/NodeBB/NodeBB/tags', function(releases) { $.get('https://api.github.com/repos/NodeBB/NodeBB/tags', function(releases) {
// Re-sort the releases, as they do not follow Semver (wrt pre-releases)
releases = releases.sort(function(a, b) {
a = a.name.replace(/^v/, '');
b = b.name.replace(/^v/, '');
return semver.lt(a, b) ? 1 : -1;
});
var version = $('#version').html(), var version = $('#version').html(),
latestVersion = releases[0].name.slice(1), latestVersion = releases[0].name.slice(1),
checkEl = $('.version-check'); checkEl = $('.version-check');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

File diff suppressed because it is too large Load Diff

@ -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 {

@ -295,7 +295,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) {

@ -173,9 +173,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;
}); });
} }
@ -218,21 +218,23 @@ var async = require('async'),
}); });
for (var i=0; i<topics.length; ++i) { for (var i=0; i<topics.length; ++i) {
topics[i].category = categories[topics[i].cid]; if (topics[i]) {
topics[i].category.disabled = parseInt(topics[i].category.disabled, 10) === 1; topics[i].category = categories[topics[i].cid];
topics[i].user = users[topics[i].uid]; topics[i].category.disabled = parseInt(topics[i].category.disabled, 10) === 1;
topics[i].teaser = results.teasers[i]; topics[i].user = users[topics[i].uid];
topics[i].tags = results.tags[i]; topics[i].teaser = results.teasers[i];
topics[i].tags = results.tags[i];
topics[i].pinned = parseInt(topics[i].pinned, 10) === 1;
topics[i].locked = parseInt(topics[i].locked, 10) === 1; topics[i].pinned = parseInt(topics[i].pinned, 10) === 1;
topics[i].deleted = parseInt(topics[i].deleted, 10) === 1; topics[i].locked = parseInt(topics[i].locked, 10) === 1;
topics[i].unread = !(results.hasRead[i] && parseInt(uid, 10) !== 0); topics[i].deleted = parseInt(topics[i].deleted, 10) === 1;
topics[i].unreplied = parseInt(topics[i].postcount, 10) <= 1; topics[i].unread = !(results.hasRead[i] && parseInt(uid, 10) !== 0);
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));
}); });

Loading…
Cancel
Save