mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
style(eslint): match operator-linebreak preferences
This commit is contained in:
committed by
Julian Lam
parent
89c025d102
commit
ba619c7ec8
@@ -40,6 +40,7 @@
|
||||
"allowTemplateLiterals": true
|
||||
}],
|
||||
"no-else-return": [ "error", { "allowElseIf": true } ],
|
||||
"operator-linebreak": [ "error", "after" ],
|
||||
|
||||
// ES6
|
||||
"prefer-rest-params": "off",
|
||||
|
||||
@@ -99,9 +99,9 @@
|
||||
} else {
|
||||
var matches = url.match(/admin\/(.+?)\/(.+?)$/);
|
||||
mainTitle = '[[admin/menu:' + matches[1] + '/' + matches[2] + ']]';
|
||||
pageTitle = '[[admin/menu:section-'
|
||||
+ (matches[1] === 'development' ? 'advanced' : matches[1])
|
||||
+ ']]' + (matches[2] ? (' > ' + mainTitle) : '');
|
||||
pageTitle = '[[admin/menu:section-' +
|
||||
(matches[1] === 'development' ? 'advanced' : matches[1]) +
|
||||
']]' + (matches[2] ? (' > ' + mainTitle) : '');
|
||||
if (matches[2] === 'settings') {
|
||||
mainTitle = translator.compile('admin/menu:settings.page-title', mainTitle);
|
||||
}
|
||||
|
||||
@@ -62,22 +62,22 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
|
||||
|
||||
graphData.rooms = data;
|
||||
|
||||
var html = '<div class="text-center pull-left">'
|
||||
+ '<span class="formatted-number">' + data.onlineRegisteredCount + '</span>'
|
||||
+ '<div class="stat">[[admin/general/dashboard:active-users.users]]</div>'
|
||||
+ '</div>'
|
||||
+ '<div class="text-center pull-left">'
|
||||
+ '<span class="formatted-number">' + data.onlineGuestCount + '</span>'
|
||||
+ '<div class="stat">[[admin/general/dashboard:active-users.guests]]</div>'
|
||||
+ '</div>'
|
||||
+ '<div class="text-center pull-left">'
|
||||
+ '<span class="formatted-number">' + (data.onlineRegisteredCount + data.onlineGuestCount) + '</span>'
|
||||
+ '<div class="stat">[[admin/general/dashboard:active-users.total]]</div>'
|
||||
+ '</div>'
|
||||
+ '<div class="text-center pull-left">'
|
||||
+ '<span class="formatted-number">' + data.socketCount + '</span>'
|
||||
+ '<div class="stat">[[admin/general/dashboard:active-users.connections]]</div>'
|
||||
+ '</div>';
|
||||
var html = '<div class="text-center pull-left">' +
|
||||
'<span class="formatted-number">' + data.onlineRegisteredCount + '</span>' +
|
||||
'<div class="stat">[[admin/general/dashboard:active-users.users]]</div>' +
|
||||
'</div>' +
|
||||
'<div class="text-center pull-left">' +
|
||||
'<span class="formatted-number">' + data.onlineGuestCount + '</span>' +
|
||||
'<div class="stat">[[admin/general/dashboard:active-users.guests]]</div>' +
|
||||
'</div>' +
|
||||
'<div class="text-center pull-left">' +
|
||||
'<span class="formatted-number">' + (data.onlineRegisteredCount + data.onlineGuestCount) + '</span>' +
|
||||
'<div class="stat">[[admin/general/dashboard:active-users.total]]</div>' +
|
||||
'</div>' +
|
||||
'<div class="text-center pull-left">' +
|
||||
'<span class="formatted-number">' + data.socketCount + '</span>' +
|
||||
'<div class="stat">[[admin/general/dashboard:active-users.connections]]</div>' +
|
||||
'</div>';
|
||||
|
||||
updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount);
|
||||
updatePresenceGraph(data.users);
|
||||
@@ -513,10 +513,10 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
|
||||
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>';
|
||||
|
||||
html += '<li>'
|
||||
+ '<div style="background-color: ' + topicColors[i] + ';"></div>'
|
||||
+ '<span> (' + topic.count + ') ' + label + '</span>'
|
||||
+ '</li>';
|
||||
html += '<li>' +
|
||||
'<div style="background-color: ' + topicColors[i] + ';"></div>' +
|
||||
'<span> (' + topic.count + ') ' + label + '</span>' +
|
||||
'</li>';
|
||||
});
|
||||
legend.translateHtml(html);
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
|
||||
'$1<span class="search-match">$2</span>$3'
|
||||
);
|
||||
|
||||
return '<li role="presentation" class="result">'
|
||||
+ '<a role= "menuitem" href= "' + config.relative_path + '/' + namespace + '" >'
|
||||
+ title
|
||||
+ '<br>' + (!results ? ''
|
||||
: ('<small><code>'
|
||||
+ results
|
||||
+ '</small></code>'))
|
||||
+ '</a>'
|
||||
+ '</li>';
|
||||
return '<li role="presentation" class="result">' +
|
||||
'<a role= "menuitem" href= "' + config.relative_path + '/' + namespace + '" >' +
|
||||
title +
|
||||
'<br>' + (!results ? '' :
|
||||
('<small><code>' +
|
||||
results +
|
||||
'</small></code>')) +
|
||||
'</a>' +
|
||||
'</li>';
|
||||
}).join('');
|
||||
return html;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpres
|
||||
var lastSpeaker = parseInt(chatContentEl.find('.chat-message').last().attr('data-uid'), 10);
|
||||
var lasttimestamp = parseInt(chatContentEl.find('.chat-message').last().attr('data-timestamp'), 10);
|
||||
if (!Array.isArray(data)) {
|
||||
data.newSet = lastSpeaker !== parseInt(data.fromuid, 10)
|
||||
|| parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3);
|
||||
data.newSet = lastSpeaker !== parseInt(data.fromuid, 10) ||
|
||||
parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3);
|
||||
}
|
||||
|
||||
messages.parseMessage(data, function (html) {
|
||||
|
||||
@@ -58,10 +58,10 @@ define('forum/chats/search', ['components'], function (components) {
|
||||
|
||||
function displayUser(chatsListEl, userObj) {
|
||||
function createUserImage() {
|
||||
return (userObj.picture
|
||||
? '<img src="' + userObj.picture + '" title="' + userObj.username + '" />'
|
||||
: '<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>')
|
||||
+ '<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
|
||||
return (userObj.picture ?
|
||||
'<img src="' + userObj.picture + '" title="' + userObj.username + '" />' :
|
||||
'<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>') +
|
||||
'<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
|
||||
}
|
||||
|
||||
var chatEl = $('<li component="chat/search/user" />')
|
||||
|
||||
@@ -23,9 +23,9 @@ define('forum/topic/images', [], function () {
|
||||
var altExt = altFilename.split('.').slice(1).pop();
|
||||
|
||||
if (!$this.parent().is('a')) {
|
||||
$this.wrap('<a href="' + src + '" '
|
||||
+ (!srcExt && altExt ? ' download="' + altFilename + '" ' : '')
|
||||
+ ' target="_blank" >');
|
||||
$this.wrap('<a href="' + src + '" ' +
|
||||
(!srcExt && altExt ? ' download="' + altFilename + '" ' : '') +
|
||||
' target="_blank" >');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -70,8 +70,8 @@ define('forum/topic/posts', [
|
||||
ajaxify.data.pagination.pageCount = Math.max(1, Math.ceil(posts[0].topic.postcount / config.postsPerPage));
|
||||
var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1;
|
||||
|
||||
var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1)
|
||||
|| (ajaxify.data.pagination.currentPage === 1 && direction === -1);
|
||||
var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1) ||
|
||||
(ajaxify.data.pagination.currentPage === 1 && direction === -1);
|
||||
|
||||
if (isPostVisible) {
|
||||
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost);
|
||||
|
||||
@@ -118,11 +118,11 @@
|
||||
category.children.forEach(function (child) {
|
||||
if (child && !child.isSection) {
|
||||
var link = child.link ? child.link : (relative_path + '/category/' + child.slug);
|
||||
html += '<span class="category-children-item pull-left">'
|
||||
+ '<div class="icon pull-left" style="' + generateCategoryBackground(child) + '">'
|
||||
+ '<i class="fa fa-fw ' + child.icon + '"></i>'
|
||||
+ '</div>'
|
||||
+ '<a href="' + link + '"><small>' + child.name + '</small></a></span>';
|
||||
html += '<span class="category-children-item pull-left">' +
|
||||
'<div class="icon pull-left" style="' + generateCategoryBackground(child) + '">' +
|
||||
'<i class="fa fa-fw ' + child.icon + '"></i>' +
|
||||
'</div>' +
|
||||
'<a href="' + link + '"><small>' + child.name + '</small></a></span>';
|
||||
}
|
||||
});
|
||||
html = html ? ('<span class="category-children">' + html + '</span>') : html;
|
||||
|
||||
@@ -19,8 +19,8 @@ define('scrollStop', function () {
|
||||
var elementHeight = Math.round(this.getBoundingClientRect().height);
|
||||
|
||||
if (
|
||||
(e.originalEvent.deltaY < 0 && scrollTop === 0) // scroll up
|
||||
|| (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down
|
||||
(e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up
|
||||
(e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,11 +116,11 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator
|
||||
|
||||
var taskbarEl = $('<li />')
|
||||
.addClass(data.options.className)
|
||||
.html('<a href="#">'
|
||||
+ (data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '')
|
||||
+ (data.options.image ? '<img src="' + data.options.image + '"/> ' : '')
|
||||
+ '<span component="taskbar/title">' + title + '</span>'
|
||||
+ '</a>')
|
||||
.html('<a href="#">' +
|
||||
(data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '') +
|
||||
(data.options.image ? '<img src="' + data.options.image + '"/> ' : '') +
|
||||
'<span component="taskbar/title">' + title + '</span>' +
|
||||
'</a>')
|
||||
.attr({
|
||||
title: title,
|
||||
'data-module': data.module,
|
||||
|
||||
@@ -74,9 +74,9 @@ define('topicList', [
|
||||
};
|
||||
|
||||
function onNewTopic(data) {
|
||||
if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1)
|
||||
|| (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched')
|
||||
|| (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) {
|
||||
if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1) ||
|
||||
(ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched') ||
|
||||
(ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,11 +91,13 @@ define('topicList', [
|
||||
}
|
||||
|
||||
var post = data.posts[0];
|
||||
if ((!post || !post.topic)
|
||||
|| (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10))
|
||||
|| (ajaxify.data.selectedCids && ajaxify.data.selectedCids.length && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1)
|
||||
|| (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new')
|
||||
|| (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))) {
|
||||
if (
|
||||
(!post || !post.topic) ||
|
||||
(parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10)) ||
|
||||
(ajaxify.data.selectedCids && ajaxify.data.selectedCids.length && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1) ||
|
||||
(ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new') ||
|
||||
(ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +181,8 @@
|
||||
cursor += 1;
|
||||
// a space or comma was found before the name
|
||||
// this isn't a translation string, so back out
|
||||
} else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound)
|
||||
&& invalidTextRegex.test(char0)) {
|
||||
} else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) &&
|
||||
invalidTextRegex.test(char0)) {
|
||||
cursor += 1;
|
||||
lastBreak -= 2;
|
||||
// no longer in a token
|
||||
|
||||
@@ -152,14 +152,14 @@ app.isConnected = false;
|
||||
}
|
||||
|
||||
if (
|
||||
config.socketioOrigins
|
||||
&& config.socketioOrigins !== '*'
|
||||
&& config.socketioOrigins.indexOf(location.hostname) === -1
|
||||
config.socketioOrigins &&
|
||||
config.socketioOrigins !== '*' &&
|
||||
config.socketioOrigins.indexOf(location.hostname) === -1
|
||||
) {
|
||||
console.error(
|
||||
'You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. \n'
|
||||
+ 'To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. \n'
|
||||
+ 'For more information, see this FAQ topic: https://community.nodebb.org/topic/13388'
|
||||
'You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. \n' +
|
||||
'To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. \n' +
|
||||
'For more information, see this FAQ topic: https://community.nodebb.org/topic/13388'
|
||||
);
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -625,10 +625,10 @@
|
||||
var rect = el.getBoundingClientRect();
|
||||
|
||||
return (
|
||||
rect.top >= 0
|
||||
&& rect.left >= 0
|
||||
&& rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */
|
||||
&& rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
|
||||
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
|
||||
);
|
||||
},
|
||||
|
||||
@@ -731,10 +731,10 @@
|
||||
},
|
||||
|
||||
isInternalURI: function (targetLocation, referenceLocation, relative_path) {
|
||||
return targetLocation.host === '' // Relative paths are always internal links
|
||||
|| (
|
||||
targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol // Otherwise need to check if protocol and host match
|
||||
&& (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check
|
||||
return targetLocation.host === '' || // Relative paths are always internal links
|
||||
(
|
||||
targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol && // Otherwise need to check if protocol and host match
|
||||
(relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ function filterDirectories(directories) {
|
||||
// exclude partials
|
||||
// only include subpaths
|
||||
// exclude category.tpl, group.tpl, category-analytics.tpl
|
||||
return !dir.endsWith('.js')
|
||||
&& !dir.includes('/partials/')
|
||||
&& /\/.*\//.test(dir)
|
||||
&& !/manage\/(category|group|category-analytics)$/.test(dir);
|
||||
return !dir.endsWith('.js') &&
|
||||
!dir.includes('/partials/') &&
|
||||
/\/.*\//.test(dir) &&
|
||||
!/manage\/(category|group|category-analytics)$/.test(dir);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -139,10 +139,10 @@ function initDict(language, callback) {
|
||||
title = '[[admin/menu:general/dashboard]]';
|
||||
} else {
|
||||
title = title.match(/admin\/(.+?)\/(.+?)$/);
|
||||
title = '[[admin/menu:section-'
|
||||
+ (title[1] === 'development' ? 'advanced' : title[1])
|
||||
+ ']]' + (title[2] ? (' > [[admin/menu:'
|
||||
+ title[1] + '/' + title[2] + ']]') : '');
|
||||
title = '[[admin/menu:section-' +
|
||||
(title[1] === 'development' ? 'advanced' : title[1]) +
|
||||
']]' + (title[2] ? (' > [[admin/menu:' +
|
||||
title[1] + '/' + title[2] + ']]') : '');
|
||||
}
|
||||
|
||||
translator.translate(title).then(function (title) {
|
||||
|
||||
@@ -65,9 +65,9 @@ Command.prototype.usage = function () {
|
||||
return humanReadableArgName(arg);
|
||||
});
|
||||
|
||||
var usage = '[options]'[optionColor]
|
||||
+ (this.commands.length ? ' [command]' : '')[subCommandColor]
|
||||
+ (this._args.length ? ' ' + args.join(' ') : '')[argColor];
|
||||
var usage = '[options]'[optionColor] +
|
||||
(this.commands.length ? ' [command]' : '')[subCommandColor] +
|
||||
(this._args.length ? ' ' + args.join(' ') : '')[argColor];
|
||||
|
||||
return usage;
|
||||
};
|
||||
@@ -90,10 +90,10 @@ Command.prototype.commandHelp = function () {
|
||||
}).join(' ');
|
||||
|
||||
return [
|
||||
cmd._name[subCommandColor]
|
||||
+ (cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor]
|
||||
+ (cmd.options.length ? ' [options]' : '')[subOptionColor]
|
||||
+ ' ' + args[subArgColor],
|
||||
cmd._name[subCommandColor] +
|
||||
(cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor] +
|
||||
(cmd.options.length ? ' [options]' : '')[subOptionColor] +
|
||||
' ' + args[subArgColor],
|
||||
cmd._description,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -27,10 +27,10 @@ function buildTargets() {
|
||||
return ' ' + _.padEnd('"' + tuple[0] + '"', length + 2).magenta + ' | ' + tuple[1];
|
||||
}).join('\n');
|
||||
console.log(
|
||||
'\n\n Build targets:\n'
|
||||
+ ('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green
|
||||
+ '\n ------------------------------------------------------\n'.blue
|
||||
+ output + '\n'
|
||||
'\n\n Build targets:\n' +
|
||||
('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green +
|
||||
'\n ------------------------------------------------------\n'.blue +
|
||||
output + '\n'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ function runUpgrade(upgrades, options) {
|
||||
|
||||
if (upgrades === true) {
|
||||
var tasks = Object.keys(steps);
|
||||
if (options.package || options.install
|
||||
|| options.plugins || options.schema || options.build) {
|
||||
if (options.package || options.install ||
|
||||
options.plugins || options.schema || options.build) {
|
||||
tasks = tasks.filter(function (key) {
|
||||
return options[key];
|
||||
});
|
||||
|
||||
@@ -88,9 +88,9 @@ function buildBreadcrumbs(currentFolder) {
|
||||
var dir = path.join(currentPath, part);
|
||||
crumbs.push({
|
||||
text: part || 'Uploads',
|
||||
url: part
|
||||
? (nconf.get('relative_path') + '/admin/manage/uploads?dir=' + dir)
|
||||
: nconf.get('relative_path') + '/admin/manage/uploads',
|
||||
url: part ?
|
||||
(nconf.get('relative_path') + '/admin/manage/uploads?dir=' + dir) :
|
||||
nconf.get('relative_path') + '/admin/manage/uploads',
|
||||
});
|
||||
currentPath = dir;
|
||||
});
|
||||
|
||||
@@ -249,10 +249,10 @@ Controllers.robots = function (req, res) {
|
||||
if (meta.config['robots:txt']) {
|
||||
res.send(meta.config['robots:txt']);
|
||||
} else {
|
||||
res.send('User-agent: *\n'
|
||||
+ 'Disallow: ' + nconf.get('relative_path') + '/admin/\n'
|
||||
+ 'Disallow: ' + nconf.get('relative_path') + '/reset/\n'
|
||||
+ 'Sitemap: ' + nconf.get('url') + '/sitemap.xml');
|
||||
res.send('User-agent: *\n' +
|
||||
'Disallow: ' + nconf.get('relative_path') + '/admin/\n' +
|
||||
'Disallow: ' + nconf.get('relative_path') + '/reset/\n' +
|
||||
'Sitemap: ' + nconf.get('url') + '/sitemap.xml');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ module.exports = function (Groups) {
|
||||
};
|
||||
|
||||
function isSystemGroup(data) {
|
||||
return data.system === true || parseInt(data.system, 10) === 1
|
||||
|| data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators'
|
||||
|| Groups.isPrivilegeGroup(data.name);
|
||||
return data.system === true || parseInt(data.system, 10) === 1 ||
|
||||
data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators' ||
|
||||
Groups.isPrivilegeGroup(data.name);
|
||||
}
|
||||
|
||||
function validateGroupName(name, callback) {
|
||||
|
||||
@@ -134,8 +134,8 @@ module.exports = function (Messaging) {
|
||||
Messaging.getMessageFields(mid, ['fromuid', 'timestamp'], next);
|
||||
},
|
||||
function (fields, next) {
|
||||
if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff)
|
||||
|| (messages[0].fromuid !== fields.fromuid)) {
|
||||
if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff) ||
|
||||
(messages[0].fromuid !== fields.fromuid)) {
|
||||
// If it's been 5 minutes, this is a new set of messages
|
||||
messages[0].newSet = true;
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ Blacklist.test = function (clientIp, callback) {
|
||||
}
|
||||
|
||||
if (
|
||||
!Blacklist._rules.ipv4.includes(clientIp) // not explicitly specified in ipv4 list
|
||||
&& !Blacklist._rules.ipv6.includes(clientIp) // not explicitly specified in ipv6 list
|
||||
&& !Blacklist._rules.cidr.some(function (subnet) {
|
||||
!Blacklist._rules.ipv4.includes(clientIp) && // not explicitly specified in ipv4 list
|
||||
!Blacklist._rules.ipv6.includes(clientIp) && // not explicitly specified in ipv6 list
|
||||
!Blacklist._rules.cidr.some(function (subnet) {
|
||||
var cidr = ipaddr.parseCIDR(subnet);
|
||||
if (addr.kind() !== cidr[0].kind()) {
|
||||
return false;
|
||||
|
||||
@@ -89,11 +89,11 @@ module.exports = function (middleware) {
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
var str = results.header
|
||||
+ (res.locals.postHeader || '')
|
||||
+ results.content + '<script id="ajaxify-data"></script>'
|
||||
+ (res.locals.preFooter || '')
|
||||
+ results.footer;
|
||||
var str = results.header +
|
||||
(res.locals.postHeader || '') +
|
||||
results.content + '<script id="ajaxify-data"></script>' +
|
||||
(res.locals.preFooter || '') +
|
||||
results.footer;
|
||||
|
||||
translate(str, req, res, next);
|
||||
},
|
||||
|
||||
@@ -106,16 +106,16 @@ function getStaticDirectories(pluginData, callback) {
|
||||
|
||||
async.each(dirs, function (route, next) {
|
||||
if (!validMappedPath.test(route)) {
|
||||
winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: '
|
||||
+ route + '. Path must adhere to: ' + validMappedPath.toString());
|
||||
winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: ' +
|
||||
route + '. Path must adhere to: ' + validMappedPath.toString());
|
||||
return next();
|
||||
}
|
||||
|
||||
var dirPath = path.join(pluginData.path, pluginData.staticDirs[route]);
|
||||
fs.stat(dirPath, function (err, stats) {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
winston.warn('[plugins/' + pluginData.id + '] Mapped path \''
|
||||
+ route + ' => ' + dirPath + '\' not found.');
|
||||
winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' +
|
||||
route + ' => ' + dirPath + '\' not found.');
|
||||
return next();
|
||||
}
|
||||
if (err) {
|
||||
@@ -123,8 +123,8 @@ function getStaticDirectories(pluginData, callback) {
|
||||
}
|
||||
|
||||
if (!stats.isDirectory()) {
|
||||
winston.warn('[plugins/' + pluginData.id + '] Mapped path \''
|
||||
+ route + ' => ' + dirPath + '\' is not a directory.');
|
||||
winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' +
|
||||
route + ' => ' + dirPath + '\' is not a directory.');
|
||||
return next();
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ function getStaticDirectories(pluginData, callback) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
winston.verbose('[plugins] found ' + Object.keys(staticDirs).length
|
||||
+ ' static directories for ' + pluginData.id);
|
||||
winston.verbose('[plugins] found ' + Object.keys(staticDirs).length +
|
||||
' static directories for ' + pluginData.id);
|
||||
callback(null, staticDirs);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ module.exports = function (Plugins) {
|
||||
var method;
|
||||
|
||||
if (Object.keys(Plugins.deprecatedHooks).includes(data.hook)) {
|
||||
winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, '
|
||||
+ (Plugins.deprecatedHooks[data.hook]
|
||||
? 'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.'
|
||||
: 'there is no alternative.'
|
||||
winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, ' +
|
||||
(Plugins.deprecatedHooks[data.hook] ?
|
||||
'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' :
|
||||
'there is no alternative.'
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -141,8 +141,8 @@ module.exports = function (privileges) {
|
||||
},
|
||||
function (results, next) {
|
||||
cids = cids.filter(function (cid, index) {
|
||||
return !results.categories[index].disabled
|
||||
&& (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
return !results.categories[index].disabled &&
|
||||
(results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
});
|
||||
|
||||
next(null, cids.filter(Boolean));
|
||||
|
||||
@@ -115,15 +115,15 @@ module.exports = function (privileges) {
|
||||
var isModOf = {};
|
||||
cids = cids.filter(function (cid, index) {
|
||||
isModOf[cid] = results.isModerators[index];
|
||||
return !results.categories[index].disabled
|
||||
&& (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
return !results.categories[index].disabled &&
|
||||
(results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
});
|
||||
|
||||
const cidsSet = new Set(cids);
|
||||
|
||||
pids = postData.filter(function (post) {
|
||||
return post.topic && cidsSet.has(post.topic.cid)
|
||||
&& ((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]);
|
||||
return post.topic && cidsSet.has(post.topic.cid) &&
|
||||
((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]);
|
||||
}).map(post => post.pid);
|
||||
|
||||
plugins.fireHook('filter:privileges.posts.filter', {
|
||||
|
||||
@@ -96,15 +96,15 @@ module.exports = function (privileges) {
|
||||
var isModOf = {};
|
||||
cids = cids.filter(function (cid, index) {
|
||||
isModOf[cid] = results.isModerators[index];
|
||||
return !results.categories[index].disabled
|
||||
&& (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
return !results.categories[index].disabled &&
|
||||
(results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
|
||||
});
|
||||
|
||||
const cidsSet = new Set(cids);
|
||||
|
||||
tids = topicsData.filter(function (topic) {
|
||||
return cidsSet.has(topic.cid)
|
||||
&& (!topic.deleted || results.isAdmin || isModOf[topic.cid]);
|
||||
return cidsSet.has(topic.cid) &&
|
||||
(!topic.deleted || results.isAdmin || isModOf[topic.cid]);
|
||||
}).map(topic => topic.tid);
|
||||
|
||||
plugins.fireHook('filter:privileges.topics.filter', {
|
||||
@@ -148,8 +148,8 @@ module.exports = function (privileges) {
|
||||
},
|
||||
function (results, next) {
|
||||
uids = uids.filter(function (uid, index) {
|
||||
return !results.disabled
|
||||
&& ((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]);
|
||||
return !results.disabled &&
|
||||
((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]);
|
||||
});
|
||||
|
||||
next(null, uids);
|
||||
@@ -197,9 +197,9 @@ module.exports = function (privileges) {
|
||||
|
||||
var preventTopicDeleteAfterReplies = meta.config.preventTopicDeleteAfterReplies;
|
||||
if (preventTopicDeleteAfterReplies && (topicData.postcount - 1) >= preventTopicDeleteAfterReplies) {
|
||||
var langKey = preventTopicDeleteAfterReplies > 1
|
||||
? '[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]'
|
||||
: '[[error:cant-delete-topic-has-reply]]';
|
||||
var langKey = preventTopicDeleteAfterReplies > 1 ?
|
||||
'[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]' :
|
||||
'[[error:cant-delete-topic-has-reply]]';
|
||||
return next(new Error(langKey));
|
||||
}
|
||||
|
||||
|
||||
@@ -173,8 +173,8 @@ module.exports = function (app, middleware, callback) {
|
||||
// DEPRECATED (v1.12.0)
|
||||
app.use(relativePath + '/assets/stylesheet.css', function (req, res) {
|
||||
if (!warned.has(req.path)) {
|
||||
winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. '
|
||||
+ 'Use `/assets/client.css` to access this file');
|
||||
winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. ' +
|
||||
'Use `/assets/client.css` to access this file');
|
||||
warned.add(req.path);
|
||||
}
|
||||
res.redirect(relativePath + '/assets/client.css?' + meta.config['cache-buster']);
|
||||
|
||||
@@ -42,8 +42,8 @@ sitemap.render = function (callback) {
|
||||
|
||||
sitemap.getPages = function (callback) {
|
||||
if (
|
||||
sitemap.maps.pages
|
||||
&& Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10)
|
||||
sitemap.maps.pages &&
|
||||
Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10)
|
||||
) {
|
||||
return sitemap.maps.pages.toXML(callback);
|
||||
}
|
||||
@@ -82,8 +82,8 @@ sitemap.getPages = function (callback) {
|
||||
|
||||
sitemap.getCategories = function (callback) {
|
||||
if (
|
||||
sitemap.maps.categories
|
||||
&& Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10)
|
||||
sitemap.maps.categories &&
|
||||
Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10)
|
||||
) {
|
||||
return sitemap.maps.categories.toXML(callback);
|
||||
}
|
||||
@@ -124,8 +124,8 @@ sitemap.getTopicPage = function (page, callback) {
|
||||
var max = min + numTopics;
|
||||
|
||||
if (
|
||||
sitemap.maps.topics[page - 1]
|
||||
&& Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10)
|
||||
sitemap.maps.topics[page - 1] &&
|
||||
Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10)
|
||||
) {
|
||||
return sitemap.maps.topics[page - 1].toXML(callback);
|
||||
}
|
||||
|
||||
@@ -249,10 +249,10 @@ SocketGroups.create = function (socket, data, callback) {
|
||||
};
|
||||
|
||||
SocketGroups.delete = isOwner(function (socket, data, callback) {
|
||||
if (data.groupName === 'administrators'
|
||||
|| data.groupName === 'registered-users'
|
||||
|| data.groupName === 'guests'
|
||||
|| data.groupName === 'Global Moderators') {
|
||||
if (data.groupName === 'administrators' ||
|
||||
data.groupName === 'registered-users' ||
|
||||
data.groupName === 'guests' ||
|
||||
data.groupName === 'Global Moderators') {
|
||||
return callback(new Error('[[error:not-allowed]]'));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ function filterTidCidIgnorers(uids, tid, cid, callback) {
|
||||
},
|
||||
function (results, next) {
|
||||
uids = uids.filter(function (uid, index) {
|
||||
return results.topicFollowed[index]
|
||||
|| (!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]);
|
||||
return results.topicFollowed[index] ||
|
||||
(!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]);
|
||||
});
|
||||
next(null, uids);
|
||||
},
|
||||
|
||||
@@ -464,9 +464,9 @@ module.exports = function (Topics) {
|
||||
function (results, next) {
|
||||
var cutoff = Topics.unreadCutoff();
|
||||
var result = tids.map(function (tid, index) {
|
||||
var read = !results.tids_unread[index]
|
||||
&& (results.topicScores[index] < cutoff
|
||||
|| !!(results.userScores[index] && results.userScores[index] >= results.topicScores[index]));
|
||||
var read = !results.tids_unread[index] &&
|
||||
(results.topicScores[index] < cutoff ||
|
||||
!!(results.userScores[index] && results.userScores[index] >= results.topicScores[index]));
|
||||
return { tid: tid, read: read, index: index };
|
||||
});
|
||||
|
||||
|
||||
@@ -240,11 +240,11 @@ module.exports = function (User) {
|
||||
function (next) {
|
||||
request({
|
||||
method: 'get',
|
||||
url: 'http://api.stopforumspam.org/api'
|
||||
+ '?ip=' + encodeURIComponent(user.ip)
|
||||
+ '&email=' + encodeURIComponent(user.email)
|
||||
+ '&username=' + encodeURIComponent(user.username)
|
||||
+ '&f=json',
|
||||
url: 'http://api.stopforumspam.org/api' +
|
||||
'?ip=' + encodeURIComponent(user.ip) +
|
||||
'&email=' + encodeURIComponent(user.email) +
|
||||
'&username=' + encodeURIComponent(user.username) +
|
||||
'&f=json',
|
||||
json: true,
|
||||
}, next);
|
||||
},
|
||||
|
||||
@@ -109,9 +109,9 @@ module.exports = function (User) {
|
||||
var expired;
|
||||
|
||||
sessions = sessions.filter(function (sessionObj, idx) {
|
||||
expired = !sessionObj || !sessionObj.hasOwnProperty('passport')
|
||||
|| !sessionObj.passport.hasOwnProperty('user')
|
||||
|| parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10);
|
||||
expired = !sessionObj || !sessionObj.hasOwnProperty('passport') ||
|
||||
!sessionObj.passport.hasOwnProperty('user') ||
|
||||
parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10);
|
||||
|
||||
if (expired) {
|
||||
expiredSids.push(_sids[idx]);
|
||||
|
||||
@@ -41,16 +41,16 @@ describe('minifier', function () {
|
||||
|
||||
assert.strictEqual(
|
||||
fs.readFileSync(destPath).toString().replace(/\r\n/g, '\n'),
|
||||
'(function (window, document) {'
|
||||
+ '\n\twindow.doStuff = function () {'
|
||||
+ '\n\t\tdocument.body.innerHTML = \'Stuff has been done\';'
|
||||
+ '\n\t};'
|
||||
+ '\n})(window, document);'
|
||||
+ '\n'
|
||||
+ '\n;function foo(name, age) {'
|
||||
+ '\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';'
|
||||
+ '\n}'
|
||||
+ '\n'
|
||||
'(function (window, document) {' +
|
||||
'\n\twindow.doStuff = function () {' +
|
||||
'\n\t\tdocument.body.innerHTML = \'Stuff has been done\';' +
|
||||
'\n\t};' +
|
||||
'\n})(window, document);' +
|
||||
'\n' +
|
||||
'\n;function foo(name, age) {' +
|
||||
'\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';' +
|
||||
'\n}' +
|
||||
'\n'
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -69,8 +69,8 @@ describe('minifier', function () {
|
||||
|
||||
assert.strictEqual(
|
||||
fs.readFileSync(destPath).toString(),
|
||||
'(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}'
|
||||
+ '\n//# sourceMappingURL=minified.js.map'
|
||||
'(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}' +
|
||||
'\n//# sourceMappingURL=minified.js.map'
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -87,8 +87,8 @@ describe('minifier', function () {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(
|
||||
buffer.toString(),
|
||||
'(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);'
|
||||
+ '\n//# sourceMappingURL=1.js.map'
|
||||
'(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);' +
|
||||
'\n//# sourceMappingURL=1.js.map'
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -45,47 +45,47 @@ var productionDbConfig = nconf.get(dbType);
|
||||
if (!testDbConfig) {
|
||||
const errorText = 'test_database is not defined';
|
||||
winston.info(
|
||||
'\n===========================================================\n'
|
||||
+ 'Please, add parameters for test database in config.json\n'
|
||||
+ 'For example (redis):\n'
|
||||
+ '"test_database": {\n'
|
||||
+ ' "host": "127.0.0.1",\n'
|
||||
+ ' "port": "6379",\n'
|
||||
+ ' "password": "",\n'
|
||||
+ ' "database": "1"\n'
|
||||
+ '}\n'
|
||||
+ ' or (mongo):\n'
|
||||
+ '"test_database": {\n'
|
||||
+ ' "host": "127.0.0.1",\n'
|
||||
+ ' "port": "27017",\n'
|
||||
+ ' "password": "",\n'
|
||||
+ ' "database": "1"\n'
|
||||
+ '}\n'
|
||||
+ ' or (mongo) in a replicaset\n'
|
||||
+ '"test_database": {\n'
|
||||
+ ' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n'
|
||||
+ ' "port": "27017,27018,27019",\n'
|
||||
+ ' "username": "",\n'
|
||||
+ ' "password": "",\n'
|
||||
+ ' "database": "nodebb_test"\n'
|
||||
+ '}\n'
|
||||
+ ' or (postgres):\n'
|
||||
+ '"test_database": {\n'
|
||||
+ ' "host": "127.0.0.1",\n'
|
||||
+ ' "port": "5432",\n'
|
||||
+ ' "username": "postgres",\n'
|
||||
+ ' "password": "",\n'
|
||||
+ ' "database": "nodebb_test"\n'
|
||||
+ '}\n'
|
||||
+ '==========================================================='
|
||||
'\n===========================================================\n' +
|
||||
'Please, add parameters for test database in config.json\n' +
|
||||
'For example (redis):\n' +
|
||||
'"test_database": {\n' +
|
||||
' "host": "127.0.0.1",\n' +
|
||||
' "port": "6379",\n' +
|
||||
' "password": "",\n' +
|
||||
' "database": "1"\n' +
|
||||
'}\n' +
|
||||
' or (mongo):\n' +
|
||||
'"test_database": {\n' +
|
||||
' "host": "127.0.0.1",\n' +
|
||||
' "port": "27017",\n' +
|
||||
' "password": "",\n' +
|
||||
' "database": "1"\n' +
|
||||
'}\n' +
|
||||
' or (mongo) in a replicaset\n' +
|
||||
'"test_database": {\n' +
|
||||
' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n' +
|
||||
' "port": "27017,27018,27019",\n' +
|
||||
' "username": "",\n' +
|
||||
' "password": "",\n' +
|
||||
' "database": "nodebb_test"\n' +
|
||||
'}\n' +
|
||||
' or (postgres):\n' +
|
||||
'"test_database": {\n' +
|
||||
' "host": "127.0.0.1",\n' +
|
||||
' "port": "5432",\n' +
|
||||
' "username": "postgres",\n' +
|
||||
' "password": "",\n' +
|
||||
' "database": "nodebb_test"\n' +
|
||||
'}\n' +
|
||||
'==========================================================='
|
||||
);
|
||||
winston.error(errorText);
|
||||
throw new Error(errorText);
|
||||
}
|
||||
|
||||
if (testDbConfig.database === productionDbConfig.database
|
||||
&& testDbConfig.host === productionDbConfig.host
|
||||
&& testDbConfig.port === productionDbConfig.port) {
|
||||
if (testDbConfig.database === productionDbConfig.database &&
|
||||
testDbConfig.host === productionDbConfig.host &&
|
||||
testDbConfig.port === productionDbConfig.port) {
|
||||
const errorText = 'test_database has the same config as production db';
|
||||
winston.error(errorText);
|
||||
throw new Error(errorText);
|
||||
|
||||
@@ -46,19 +46,19 @@ describe('admin search', function () {
|
||||
describe('sanitize', function () {
|
||||
it('should strip out scripts', function (done) {
|
||||
assert.equal(
|
||||
search.sanitize('Pellentesque tristique senectus'
|
||||
+ '<script>alert("nope");</script> habitant morbi'),
|
||||
'Pellentesque tristique senectus'
|
||||
+ ' habitant morbi'
|
||||
search.sanitize('Pellentesque tristique senectus' +
|
||||
'<script>alert("nope");</script> habitant morbi'),
|
||||
'Pellentesque tristique senectus' +
|
||||
' habitant morbi'
|
||||
);
|
||||
done();
|
||||
});
|
||||
it('should remove all tags', function (done) {
|
||||
assert.equal(
|
||||
search.sanitize('<p>Pellentesque <b>habitant morbi</b> tristique senectus'
|
||||
+ 'Aenean <i>vitae</i> est.Mauris <a href="placerat">eleifend</a> leo.</p>'),
|
||||
'Pellentesque habitant morbi tristique senectus'
|
||||
+ 'Aenean vitae est.Mauris eleifend leo.'
|
||||
search.sanitize('<p>Pellentesque <b>habitant morbi</b> tristique senectus' +
|
||||
'Aenean <i>vitae</i> est.Mauris <a href="placerat">eleifend</a> leo.</p>'),
|
||||
'Pellentesque habitant morbi tristique senectus' +
|
||||
'Aenean vitae est.Mauris eleifend leo.'
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -67,19 +67,19 @@ describe('admin search', function () {
|
||||
describe('simplify', function () {
|
||||
it('should remove all mustaches', function (done) {
|
||||
assert.equal(
|
||||
search.simplify('Pellentesque tristique {{senectus}}habitant morbi'
|
||||
+ 'liquam tincidunt {mauris.eu}risus'),
|
||||
'Pellentesque tristique habitant morbi'
|
||||
+ 'liquam tincidunt risus'
|
||||
search.simplify('Pellentesque tristique {{senectus}}habitant morbi' +
|
||||
'liquam tincidunt {mauris.eu}risus'),
|
||||
'Pellentesque tristique habitant morbi' +
|
||||
'liquam tincidunt risus'
|
||||
);
|
||||
done();
|
||||
});
|
||||
it('should collapse all whitespace', function (done) {
|
||||
assert.equal(
|
||||
search.simplify('Pellentesque tristique habitant morbi'
|
||||
+ ' \n\n liquam tincidunt mauris eu risus.'),
|
||||
'Pellentesque tristique habitant morbi'
|
||||
+ '\nliquam tincidunt mauris eu risus.'
|
||||
search.simplify('Pellentesque tristique habitant morbi' +
|
||||
' \n\n liquam tincidunt mauris eu risus.'),
|
||||
'Pellentesque tristique habitant morbi' +
|
||||
'\nliquam tincidunt mauris eu risus.'
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user