ESlint key-spacing, no-trailing-spaces

v1.18.x
Peter Jaszkowiak 8 years ago
parent 34e233fe1d
commit 277a7fb8b4

@ -20,6 +20,7 @@
"no-empty": ["error", { "allowEmptyCatch": true }], "no-empty": ["error", { "allowEmptyCatch": true }],
"prefer-rest-params": "off", "prefer-rest-params": "off",
"prefer-spread": "off", "prefer-spread": "off",
"no-underscore-dangle": "off",
// "linebreak-style": "off", // "linebreak-style": "off",
// "one-var": "off", // "one-var": "off",
@ -95,9 +96,8 @@
"no-mixed-operators": "off", "no-mixed-operators": "off",
"comma-spacing": "off", "comma-spacing": "off",
"global-require": "off", "global-require": "off",
"no-trailing-spaces": "off", // "no-trailing-spaces": "off",
"key-spacing": "off", // "key-spacing": "off",
"no-underscore-dangle": "off",
// "no-multiple-empty-lines": "off", // "no-multiple-empty-lines": "off",
// "spaced-comment": "off", // "spaced-comment": "off",
// "space-in-parens": "off", // "space-in-parens": "off",

@ -19,7 +19,7 @@ module.exports = function (grunt) {
var fromFile = ''; var fromFile = '';
var compiling = ''; var compiling = '';
var time = Date.now(); var time = Date.now();
if (target === 'lessUpdated_Client') { if (target === 'lessUpdated_Client') {
compiling = 'clientCSS'; compiling = 'clientCSS';
} else if (target === 'lessUpdated_Admin') { } else if (target === 'lessUpdated_Admin') {
@ -137,7 +137,7 @@ module.exports = function (grunt) {
} else { } else {
grunt.registerTask('default', ['watch']); grunt.registerTask('default', ['watch']);
} }
env.NODE_ENV = 'development'; env.NODE_ENV = 'development';

@ -112,7 +112,7 @@ function loadConfig(callback) {
nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path'))); nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
nconf.set('core_templates_path', path.join(__dirname, 'src/views')); nconf.set('core_templates_path', path.join(__dirname, 'src/views'));
nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-persona/templates')); nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-persona/templates'));
nconf.set('upload_path', path.resolve(nconf.get('base_dir'), nconf.get('upload_path'))); nconf.set('upload_path', path.resolve(nconf.get('base_dir'), nconf.get('upload_path')));
if (nconf.get('url')) { if (nconf.get('url')) {

@ -120,7 +120,7 @@ function launch(req, res) {
async.parallel([ async.parallel([
async.apply(fs.unlink(path.join(__dirname, '../public/installer.css'))), async.apply(fs.unlink(path.join(__dirname, '../public/installer.css'))),
async.apply(fs.unlink(path.join(__dirname, '../public/installer.min.js'))), async.apply(fs.unlink(path.join(__dirname, '../public/installer.min.js'))),
], function (err) { ], function (err) {
if (err) { if (err) {
winston.warn('Unable to remove installer files'); winston.warn('Unable to remove installer files');

@ -115,7 +115,7 @@
} else { } else {
var matches = url.match(/admin\/(.+?)\/(.+?)$/); var matches = url.match(/admin\/(.+?)\/(.+?)$/);
mainTitle = '[[admin/menu:' + matches[1] + '/' + matches[2] + ']]'; mainTitle = '[[admin/menu:' + matches[1] + '/' + matches[2] + ']]';
pageTitle = '[[admin/menu:section-' + pageTitle = '[[admin/menu:section-' +
(matches[1] === 'development' ? 'advanced' : matches[1]) + (matches[1] === 'development' ? 'advanced' : matches[1]) +
']]' + (matches[2] ? (' > ' + mainTitle) : ''); ']]' + (matches[2] ? (' > ' + mainTitle) : '');
if (matches[2] === 'settings') { if (matches[2] === 'settings') {
@ -176,18 +176,18 @@
function configureSlidemenu() { function configureSlidemenu() {
var env = utils.findBootstrapEnvironment(); var env = utils.findBootstrapEnvironment();
var slideout = new Slideout({ var slideout = new Slideout({
panel: document.getElementById('panel'), panel: document.getElementById('panel'),
menu: document.getElementById('menu'), menu: document.getElementById('menu'),
padding: 256, padding: 256,
tolerance: 70, tolerance: 70,
}); });
if (env === 'md' || env === 'lg') { if (env === 'md' || env === 'lg') {
slideout.disableTouch(); slideout.disableTouch();
} }
$('#mobile-menu').on('click', function () { $('#mobile-menu').on('click', function () {
slideout.toggle(); slideout.toggle();
}); });
@ -198,14 +198,14 @@
$(window).on('resize', function () { $(window).on('resize', function () {
slideout.close(); slideout.close();
env = utils.findBootstrapEnvironment(); env = utils.findBootstrapEnvironment();
if (env === 'md' || env === 'lg') { if (env === 'md' || env === 'lg') {
slideout.disableTouch(); slideout.disableTouch();
$('#header').css({ $('#header').css({
position: 'relative', position: 'relative',
}); });
} else { } else {
slideout.enableTouch(); slideout.enableTouch();
$('#header').css({ $('#header').css({
@ -222,7 +222,7 @@
} }
slideout.on('open', onOpeningMenu); slideout.on('open', onOpeningMenu);
slideout.on('close', function () { slideout.on('close', function () {
$('#header').css({ $('#header').css({
top: '0px', top: '0px',

@ -71,7 +71,7 @@ define('admin/advanced/errors', ['Chart', 'translator'], function (Chart, transl
notFoundCanvas.width = $(notFoundCanvas).parent().width(); notFoundCanvas.width = $(notFoundCanvas).parent().width();
tooBusyCanvas.width = $(tooBusyCanvas).parent().width(); tooBusyCanvas.width = $(tooBusyCanvas).parent().width();
new Chart(notFoundCanvas.getContext('2d'), { new Chart(notFoundCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data['not-found'], data: data['not-found'],
@ -89,7 +89,7 @@ define('admin/advanced/errors', ['Chart', 'translator'], function (Chart, transl
}, },
}, },
}); });
new Chart(tooBusyCanvas.getContext('2d'), { new Chart(tooBusyCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data.toobusy, data: data.toobusy,

@ -3,23 +3,23 @@
define('admin/appearance/customise', ['admin/settings'], function (Settings) { define('admin/appearance/customise', ['admin/settings'], function (Settings) {
var Customise = {}; var Customise = {};
Customise.init = function () { Customise.init = function () {
Settings.prepare(function () { Settings.prepare(function () {
$('#customCSS').text($('#customCSS-holder').val()); $('#customCSS').text($('#customCSS-holder').val());
$('#customHTML').text($('#customHTML-holder').val()); $('#customHTML').text($('#customHTML-holder').val());
var customCSS = ace.edit("customCSS"); var customCSS = ace.edit("customCSS");
var customHTML = ace.edit("customHTML"); var customHTML = ace.edit("customHTML");
customCSS.setTheme("ace/theme/twilight"); customCSS.setTheme("ace/theme/twilight");
customCSS.getSession().setMode("ace/mode/css"); customCSS.getSession().setMode("ace/mode/css");
customCSS.on('change', function (event) { customCSS.on('change', function (event) {
app.flags = app.flags || {}; app.flags = app.flags || {};
app.flags._unsaved = true; app.flags._unsaved = true;
$('#customCSS-holder').val(customCSS.getValue()); $('#customCSS-holder').val(customCSS.getValue());
}); });
customHTML.setTheme("ace/theme/twilight"); customHTML.setTheme("ace/theme/twilight");
customHTML.getSession().setMode("ace/mode/html"); customHTML.getSession().setMode("ace/mode/html");
@ -28,10 +28,9 @@ define('admin/appearance/customise', ['admin/settings'], function (Settings) {
app.flags = app.flags || {}; app.flags = app.flags || {};
app.flags._unsaved = true; app.flags._unsaved = true;
$('#customHTML-holder').val(customHTML.getValue()); $('#customHTML-holder').val(customHTML.getValue());
}); });
}); });
}; };
return Customise; return Customise;
}); });

@ -3,7 +3,7 @@
define('admin/appearance/skins', ['translator'], function (translator) { define('admin/appearance/skins', ['translator'], function (translator) {
var Skins = {}; var Skins = {};
Skins.init = function () { Skins.init = function () {
// Populate skins from Bootswatch API // Populate skins from Bootswatch API
$.ajax({ $.ajax({

@ -39,7 +39,7 @@ define('admin/appearance/themes', ['translator'], function (translator) {
}); });
} }
}); });
$('#revert_theme').on('click', function () { $('#revert_theme').on('click', function () {
bootbox.confirm('[[admin/appearance/themes:revert-confirm]]', function (confirm) { bootbox.confirm('[[admin/appearance/themes:revert-confirm]]', function (confirm) {
if (confirm) { if (confirm) {
@ -72,7 +72,7 @@ define('admin/appearance/themes', ['translator'], function (translator) {
if (!themes.length) { if (!themes.length) {
instListEl.append($('<li/ >').addClass('no-themes').translateHtml('[[admin/appearance/themes:no-themes]]')); instListEl.append($('<li/ >').addClass('no-themes').translateHtml('[[admin/appearance/themes:no-themes]]'));
} else { } else {
templates.parse('admin/partials/theme_list', { templates.parse('admin/partials/theme_list', {
themes: themes, themes: themes,

@ -23,7 +23,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
graphInterval: 15000, graphInterval: 15000,
realtimeInterval: 1500, realtimeInterval: 1500,
}; };
$(window).on('action:ajaxify.start', function (ev, data) { $(window).on('action:ajaxify.start', function (ev, data) {
clearInterval(intervals.rooms); clearInterval(intervals.rooms);
clearInterval(intervals.graphs); clearInterval(intervals.graphs);
@ -229,7 +229,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
}, },
}, },
}); });
graphs.registered = new Chart(registeredCtx, { graphs.registered = new Chart(registeredCtx, {
type: 'doughnut', type: 'doughnut',
data: { data: {
@ -265,7 +265,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
}, },
}, },
}); });
graphs.topics = new Chart(topicsCtx, { graphs.topics = new Chart(topicsCtx, {
type: 'doughnut', type: 'doughnut',
data: { data: {
@ -371,7 +371,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
graphs.presence.update(); graphs.presence.update();
} }
function updateTopicsGraph(topics) { function updateTopicsGraph(topics) {
if (!Object.keys(topics).length) { if (!Object.keys(topics).length) {
topics = {0: { topics = {0: {
@ -381,26 +381,26 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
} }
var tids = Object.keys(topics); 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) { for (var i = 0, ii = tids.length; i < ii; i += 1) {
graphs.topics.data.labels.push(topics[tids[i]].title); graphs.topics.data.labels.push(topics[tids[i]].title);
graphs.topics.data.datasets[0].data.push(topics[tids[i]].value); graphs.topics.data.datasets[0].data.push(topics[tids[i]].value);
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) { for (var i = 0, ii = tids.length; i < ii; i += 1) {
var topic = topics[tids[i]]; 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>'; var label = topic.value === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + tids[i] + '" target="_blank"> ' + topic.title + '</a>';
legend.append( legend.append(
'<li>' + '<li>' +
'<div style="background-color: ' + topicColors[i] + ';"></div>' + '<div style="background-color: ' + topicColors[i] + ';"></div>' +

@ -21,7 +21,7 @@ define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], fun
stop: drop, stop: drop,
}); });
}); });
$('#active-navigation').sortable().droppable({ $('#active-navigation').sortable().droppable({
accept: $('#available li .drag-item'), accept: $('#available li .drag-item'),
}); });
@ -81,7 +81,7 @@ define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], fun
li = $(translator.unescape(li)); li = $(translator.unescape(li));
$('#enabled').append(li); $('#enabled').append(li);
componentHandler.upgradeDom(); componentHandler.upgradeDom();
}); });
}); });
} }

@ -12,7 +12,7 @@ define('admin/general/social', [], function () {
networks.push($(this).attr('id')); networks.push($(this).attr('id'));
} }
}); });
socket.emit('admin.social.savePostSharingNetworks', networks, function (err) { socket.emit('admin.social.savePostSharingNetworks', networks, function (err) {
if (err) { if (err) {
return app.alertError(err); return app.alertError(err);

@ -87,7 +87,7 @@ define('admin/manage/category-analytics', ['Chart'], function (Chart) {
dailyCanvas.width = $(dailyCanvas).parent().width(); dailyCanvas.width = $(dailyCanvas).parent().width();
topicsCanvas.width = $(topicsCanvas).parent().width(); topicsCanvas.width = $(topicsCanvas).parent().width();
postsCanvas.width = $(postsCanvas).parent().width(); postsCanvas.width = $(postsCanvas).parent().width();
new Chart(hourlyCanvas.getContext('2d'), { new Chart(hourlyCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data['pageviews:hourly'], data: data['pageviews:hourly'],
@ -106,7 +106,7 @@ define('admin/manage/category-analytics', ['Chart'], function (Chart) {
}, },
}, },
}); });
new Chart(dailyCanvas.getContext('2d'), { new Chart(dailyCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data['pageviews:daily'], data: data['pageviews:daily'],
@ -125,7 +125,7 @@ define('admin/manage/category-analytics', ['Chart'], function (Chart) {
}, },
}, },
}); });
new Chart(topicsCanvas.getContext('2d'), { new Chart(topicsCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data['topics:daily'], data: data['topics:daily'],
@ -144,7 +144,7 @@ define('admin/manage/category-analytics', ['Chart'], function (Chart) {
}, },
}, },
}); });
new Chart(postsCanvas.getContext('2d'), { new Chart(postsCanvas.getContext('2d'), {
type: 'line', type: 'line',
data: data['posts:daily'], data: data['posts:daily'],

@ -133,7 +133,7 @@ define('admin/manage/flags', [
} }
function updateFlagDetails(source) { function updateFlagDetails(source) {
// As the flag details are returned in the API, // As the flag details are returned in the API,
// update the form controls to show the correct data // update the form controls to show the correct data
// Create reference hash for use in this method // Create reference hash for use in this method

@ -89,7 +89,7 @@ define('admin/manage/tags', [
var title = tagsToModify.length > 1 ? '[[admin/manage/tags:alerts.editing-multiple]]' : '[[admin/manage/tags:alerts.editing-x, ' + firstTag.find('.tag-item').text() + ']]'; var title = tagsToModify.length > 1 ? '[[admin/manage/tags:alerts.editing-multiple]]' : '[[admin/manage/tags:alerts.editing-x, ' + firstTag.find('.tag-item').text() + ']]';
var modal = bootbox.dialog({ var modal = bootbox.dialog({
title: title, title: title,
message: firstTag.find('.tag-modal').html(), message: firstTag.find('.tag-modal').html(),
buttons: { buttons: {
success: { success: {
@ -155,8 +155,8 @@ define('admin/manage/tags', [
function save(tag) { function save(tag) {
var data = { var data = {
tag: tag.attr('data-tag'), tag: tag.attr('data-tag'),
bgColor : tag.find('[data-name="bgColor"]').val(), bgColor: tag.find('[data-name="bgColor"]').val(),
color : tag.find('[data-name="color"]').val(), color: tag.find('[data-name="color"]').val(),
}; };
socket.emit('admin.tags.update', data, function (err) { socket.emit('admin.tags.update', data, function (err) {

@ -128,7 +128,7 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
menu.toggleClass('state-start-typing', len === 0); menu.toggleClass('state-start-typing', len === 0);
menu.toggleClass('state-keep-typing', len > 0 && len < 3); menu.toggleClass('state-keep-typing', len > 0 && len < 3);
if (len >= 3) { if (len >= 3) {
menu.prepend(find(dict, value)); menu.prepend(find(dict, value));

@ -158,7 +158,7 @@ $(document).ready(function () {
app.alertError('[[global:please_log_in]]'); app.alertError('[[global:please_log_in]]');
app.previousUrl = url; app.previousUrl = url;
window.location.href = config.relative_path + '/login'; window.location.href = config.relative_path + '/login';
} else if (status === 302 || status === 308) { } else if (status === 302 || status === 308) {
if (data.responseJSON && data.responseJSON.external) { if (data.responseJSON && data.responseJSON.external) {
window.location.href = data.responseJSON.external; window.location.href = data.responseJSON.external;

@ -223,7 +223,7 @@ app.cacheBuster = null;
app.createStatusTooltips = function () { app.createStatusTooltips = function () {
if (!utils.isTouchDevice()) { if (!utils.isTouchDevice()) {
$('body').tooltip({ $('body').tooltip({
selector:'.fa-circle.status', selector: '.fa-circle.status',
placement: 'top', placement: 'top',
}); });
} }
@ -481,7 +481,7 @@ app.cacheBuster = null;
searchButton.on('click', function (e) { searchButton.on('click', function (e) {
if (!config.loggedIn && !config.allowGuestSearching) { if (!config.loggedIn && !config.allowGuestSearching) {
app.alert({ app.alert({
message:'[[error:search-requires-login]]', message: '[[error:search-requires-login]]',
timeout: 3000, timeout: 3000,
}); });
ajaxify.go('login'); ajaxify.go('login');

@ -241,9 +241,9 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
if (!url) { if (!url) {
return; return;
} }
uploadModal.modal('hide'); uploadModal.modal('hide');
pictureCropper.handleImageCrop({ pictureCropper.handleImageCrop({
url: url, url: url,
socketMethod: 'user.uploadCroppedPicture', socketMethod: 'user.uploadCroppedPicture',
@ -251,7 +251,7 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
paramName: 'uid', paramName: 'uid',
paramValue: ajaxify.data.theirid, paramValue: ajaxify.data.theirid,
}, onUploadComplete); }, onUploadComplete);
return false; return false;
}); });
}); });

@ -21,10 +21,10 @@ define('forum/account/profile', [
socket.removeListener('event:user_status_change', onUserStatusChange); socket.removeListener('event:user_status_change', onUserStatusChange);
socket.on('event:user_status_change', onUserStatusChange); socket.on('event:user_status_change', onUserStatusChange);
if (!config.usePagination) { if (!config.usePagination) {
infinitescroll.init(loadMorePosts); infinitescroll.init(loadMorePosts);
} }
}; };
function processPage() { function processPage() {

@ -3,9 +3,9 @@
define('forum/category/tools', [ define('forum/category/tools', [
'forum/topic/move', 'forum/topic/move',
'topicSelect', 'topicSelect',
'components', 'components',
'translator', 'translator',
], function (move, topicSelect, components, translator) { ], function (move, topicSelect, components, translator) {

@ -25,7 +25,7 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function
message: msg, message: msg,
mid: mid, mid: mid,
}); });
if (!mid) { if (!mid) {
socket.emit('modules.chats.send', { socket.emit('modules.chats.send', {
roomId: roomId, roomId: roomId,

@ -40,11 +40,11 @@ define('forum/chats/search', ['components'], function (components) {
function displayResults(chatsListEl, data) { function displayResults(chatsListEl, data) {
chatsListEl.empty(); chatsListEl.empty();
data.users = data.users.filter(function (user) { data.users = data.users.filter(function (user) {
return parseInt(user.uid, 10) !== parseInt(app.user.uid, 10); return parseInt(user.uid, 10) !== parseInt(app.user.uid, 10);
}); });
if (!data.users.length) { if (!data.users.length) {
return chatsListEl.translateHtml('<li><div><span>[[users:no-users-found]]</span></div></li>'); return chatsListEl.translateHtml('<li><div><span>[[users:no-users-found]]</span></div></li>');
} }

@ -273,7 +273,7 @@ define('forum/groups/details', [
if (!confirm) { if (!confirm) {
return; return;
} }
socket.emit('groups.cover.remove', { socket.emit('groups.cover.remove', {
groupName: ajaxify.data.group.name, groupName: ajaxify.data.group.name,
}, function (err) { }, function (err) {

@ -155,10 +155,10 @@ define('forum/topic', [
message: '[[topic:bookmark_instructions]]', message: '[[topic:bookmark_instructions]]',
timeout: 0, timeout: 0,
type: 'info', type: 'info',
clickfn : function () { clickfn: function () {
navigator.scrollToPost(parseInt(bookmark - 1, 10), true); navigator.scrollToPost(parseInt(bookmark - 1, 10), true);
}, },
closefn : function () { closefn: function () {
localStorage.removeItem('topic:' + tid + ':bookmark'); localStorage.removeItem('topic:' + tid + ':bookmark');
}, },
}); });

@ -187,17 +187,17 @@ define('chat', [
}); });
chatModal.draggable({ chatModal.draggable({
start:function () { start: function () {
module.bringModalToTop(chatModal); module.bringModalToTop(chatModal);
}, },
stop:function () { stop: function () {
chatModal.find('#chat-message-input').focus(); chatModal.find('#chat-message-input').focus();
}, },
distance: 10, distance: 10,
handle: '.modal-header', handle: '.modal-header',
}); });
}); });
scrollStop.apply(chatModal.find('[component="chat/messages"]')); scrollStop.apply(chatModal.find('[component="chat/messages"]'));
chatModal.find('#chat-close-btn').on('click', function () { chatModal.find('#chat-close-btn').on('click', function () {

@ -1,6 +1,6 @@
(function (exports) { (function (exports) {
"use strict"; "use strict";
// export the class if we are in a Node-like system. // export the class if we are in a Node-like system.
if (typeof module === 'object' && module.exports === exports) { if (typeof module === 'object' && module.exports === exports) {

@ -16,7 +16,7 @@ define('iconSelect', function () {
$('#icons .fa-icons .fa.' + selected).addClass('selected'); $('#icons .fa-icons .fa.' + selected).addClass('selected');
} catch (err) { } catch (err) {
selected = ''; selected = '';
} }
} }
templates.parse('partials/fontawesome', {}, function (html) { templates.parse('partials/fontawesome', {}, function (html) {

@ -57,18 +57,18 @@ define('pictureCropper', ['translator', 'cropper'], function (translator, croppe
cropperModal.find('.reset').on('click', function () { cropperModal.find('.reset').on('click', function () {
cropperTool.reset(); cropperTool.reset();
}); });
cropperModal.find('.crop-btn').on('click', function () { cropperModal.find('.crop-btn').on('click', function () {
$(this).addClass('disabled'); $(this).addClass('disabled');
var imageData = data.imageType ? cropperTool.getCroppedCanvas().toDataURL(data.imageType) : cropperTool.getCroppedCanvas().toDataURL(); var imageData = data.imageType ? cropperTool.getCroppedCanvas().toDataURL(data.imageType) : cropperTool.getCroppedCanvas().toDataURL();
cropperModal.find('#upload-progress-bar').css('width', '100%'); cropperModal.find('#upload-progress-bar').css('width', '100%');
cropperModal.find('#upload-progress-box').show().removeClass('hide'); cropperModal.find('#upload-progress-box').show().removeClass('hide');
var socketData = {}; var socketData = {};
socketData[data.paramName] = data.paramValue; socketData[data.paramName] = data.paramValue;
socketData.imageData = imageData; socketData.imageData = imageData;
socket.emit(data.socketMethod, socketData, function (err, imageData) { socket.emit(data.socketMethod, socketData, function (err, imageData) {
if (err) { if (err) {
cropperModal.find('#upload-progress-box').hide(); cropperModal.find('#upload-progress-box').hide();

@ -17,7 +17,7 @@ define('scrollStop', function () {
var scrollTop = this.scrollTop; var scrollTop = this.scrollTop;
var scrollHeight = this.scrollHeight; var scrollHeight = this.scrollHeight;
var elementHeight = this.getBoundingClientRect().height; var elementHeight = this.getBoundingClientRect().height;
if ( if (
(e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up (e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up
(e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down

@ -39,7 +39,7 @@ define('taskbar', function () {
taskbar.discard = function (module, uuid) { taskbar.discard = function (module, uuid) {
var btnEl = taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"]'); var btnEl = taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"]');
btnEl.remove(); btnEl.remove();
update(); update();
}; };

@ -155,7 +155,7 @@
while (cursor + 2 <= len) { while (cursor + 2 <= len) {
sliced = str.slice(cursor, cursor + 2); sliced = str.slice(cursor, cursor + 2);
// found some text after the double bracket, // found some text after the double bracket,
// so this is probably a translation string // so this is probably a translation string
if (!textBeforeColonFound && validTextRegex.test(sliced[0])) { if (!textBeforeColonFound && validTextRegex.test(sliced[0])) {
textBeforeColonFound = true; textBeforeColonFound = true;
@ -174,7 +174,7 @@
cursor += 1; cursor += 1;
// a space or comma was found before the name // a space or comma was found before the name
// this isn't a translation string, so back out // this isn't a translation string, so back out
} else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) && } else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) &&
invalidTextRegex.test(sliced[0])) { invalidTextRegex.test(sliced[0])) {
cursor += 1; cursor += 1;
lastBreak -= 2; lastBreak -= 2;

@ -85,7 +85,7 @@ if ('undefined' !== typeof window) {
}); });
} }
}); });
}(jQuery || {fn:{}})); }(jQuery || {fn: {}}));
(function () { (function () {
// FIX FOR #1245 - https://github.com/NodeBB/NodeBB/issues/1245 // FIX FOR #1245 - https://github.com/NodeBB/NodeBB/issues/1245

@ -241,9 +241,9 @@
return Date.prototype.toISOString ? new Date(parseInt(timestamp, 10)).toISOString() : timestamp; return Date.prototype.toISOString ? new Date(parseInt(timestamp, 10)).toISOString() : timestamp;
}, },
tags : ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'], tags: ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'],
stripTags : ['abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'base', 'basefont', stripTags: ['abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'base', 'basefont',
'bdi', 'bdo', 'big', 'blink', 'body', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'bdi', 'bdo', 'big', 'blink', 'body', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup',
'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed',
'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',

@ -137,7 +137,7 @@ function initDict(language, callback) {
title = '[[admin/menu:general/dashboard]]'; title = '[[admin/menu:general/dashboard]]';
} else { } else {
title = title.match(/admin\/(.+?)\/(.+?)$/); title = title.match(/admin\/(.+?)\/(.+?)$/);
title = '[[admin/menu:section-' + title = '[[admin/menu:section-' +
(title[1] === 'development' ? 'advanced' : title[1]) + (title[1] === 'development' ? 'advanced' : title[1]) +
']]' + (title[2] ? (' > [[admin/menu:' + ']]' + (title[2] ? (' > [[admin/menu:' +
title[1] + '/' + title[2] + ']]') : ''); title[1] + '/' + title[2] + ']]') : '');

@ -20,14 +20,14 @@ dashboardController.get = function (req, res, next) {
{ {
done: !meta.reloadRequired, done: !meta.reloadRequired,
doneText: '[[admin/general/dashboard:restart-not-required]]', doneText: '[[admin/general/dashboard:restart-not-required]]',
notDoneText:'[[admin/general/dashboard:restart-required]]', notDoneText: '[[admin/general/dashboard:restart-required]]',
}, },
{ {
done: plugins.hasListeners('filter:search.query'), done: plugins.hasListeners('filter:search.query'),
doneText: '[[admin/general/dashboard:search-plugin-installed]]', doneText: '[[admin/general/dashboard:search-plugin-installed]]',
notDoneText:'[[admin/general/dashboard:search-plugin-not-installed]]', notDoneText: '[[admin/general/dashboard:search-plugin-not-installed]]',
tooltip: '[[admin/general/dashboard:search-plugin-tooltip]]', tooltip: '[[admin/general/dashboard:search-plugin-tooltip]]',
link:'/admin/extend/plugins', link: '/admin/extend/plugins',
}, },
]; ];
plugins.fireHook('filter:admin.notices', notices, next); plugins.fireHook('filter:admin.notices', notices, next);

@ -90,7 +90,7 @@ groupsController.details = function (req, res, callback) {
posts: function (next) { posts: function (next) {
groups.getLatestMemberPosts(groupName, 10, req.uid, next); groups.getLatestMemberPosts(groupName, 10, req.uid, next);
}, },
isAdmin:function (next) { isAdmin: function (next) {
user.isAdministrator(req.uid, next); user.isAdministrator(req.uid, next);
}, },
isGlobalMod: function (next) { isGlobalMod: function (next) {

@ -414,7 +414,7 @@ Controllers.handleURIErrors = function (err, req, res, next) {
} }
} }
} else { } else {
next(err); next(err);
} }

@ -14,9 +14,9 @@ coverPhoto.getDefaultProfileCover = function (uid) {
}; };
function getCover(type, id) { function getCover(type, id) {
if (meta.config[type + ':defaultCovers']) { if (meta.config[type + ':defaultCovers']) {
var covers = meta.config[type + ':defaultCovers'].trim().split(/[\s,]+/g); var covers = meta.config[type + ':defaultCovers'].trim().split(/[\s,]+/g);
if (typeof id === 'string') { if (typeof id === 'string') {
id = (id.charCodeAt(0) + id.charCodeAt(1)) % covers.length; id = (id.charCodeAt(0) + id.charCodeAt(1)) % covers.length;
} else { } else {

@ -216,7 +216,7 @@ module.exports = function (db, module) {
data[field] = ''; data[field] = '';
}); });
db.collection('objects').update({_key: key}, {$unset : data}, function (err) { db.collection('objects').update({_key: key}, {$unset: data}, function (err) {
callback(err); callback(err);
}); });
}; };

@ -18,7 +18,7 @@ module.exports = function (db, module) {
} }
if (exists) { if (exists) {
db.collection('objects').update({_key:key}, {$push: {array: {$each: [value], $position: 0}}}, {upsert:true, w:1 }, function (err, res) { db.collection('objects').update({_key: key}, {$push: {array: {$each: [value], $position: 0}}}, {upsert: true, w: 1 }, function (err, res) {
callback(err); callback(err);
}); });
} else { } else {
@ -33,7 +33,7 @@ module.exports = function (db, module) {
return callback(); return callback();
} }
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').update({ _key: key }, { $push: { array: value } }, {upsert:true, w:1}, function (err, res) { db.collection('objects').update({ _key: key }, { $push: { array: value } }, {upsert: true, w: 1}, function (err, res) {
callback(err); callback(err);
}); });
}; };
@ -87,7 +87,7 @@ module.exports = function (db, module) {
return callback(); return callback();
} }
db.collection('objects').findOne({_key:key}, { array: 1}, function (err, data) { db.collection('objects').findOne({_key: key}, { array: 1}, function (err, data) {
if(err || !(data && data.array)) { if(err || !(data && data.array)) {
return callback(err, []); return callback(err, []);
} }

@ -76,7 +76,7 @@ module.exports = function (db, module) {
module.rename = function (oldKey, newKey, callback) { module.rename = function (oldKey, newKey, callback) {
callback = callback || helpers.noop; callback = callback || helpers.noop;
db.collection('objects').update({_key: oldKey}, {$set:{_key: newKey}}, {multi: true}, function (err, res) { db.collection('objects').update({_key: oldKey}, {$set: {_key: newKey}}, {multi: true}, function (err, res) {
callback(err); callback(err);
}); });
}; };

@ -133,7 +133,7 @@ module.exports = function (db, module) {
} }
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').find({_key: {$in : sets}, members: value}, {_id:0, members: 0}).toArray(function (err, result) { db.collection('objects').find({_key: {$in: sets}, members: value}, {_id: 0, members: 0}).toArray(function (err, result) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
@ -205,7 +205,7 @@ module.exports = function (db, module) {
module.setRemoveRandom = function (key, callback) { module.setRemoveRandom = function (key, callback) {
callback = callback || function () {}; callback = callback || function () {};
db.collection('objects').findOne({_key:key}, function (err, data) { db.collection('objects').findOne({_key: key}, function (err, data) {
if(err || !data) { if(err || !data) {
return callback(err); return callback(err);
} }

@ -157,7 +157,7 @@ module.exports = function (db, module) {
return callback(); return callback();
} }
var pipeline = [ var pipeline = [
{ $match : { _key : { $in: keys } } } , { $match: { _key: { $in: keys } } } ,
{ $group: { _id: {_key: '$_key'}, count: { $sum: 1 } } }, { $group: { _id: {_key: '$_key'}, count: { $sum: 1 } } },
{ $project: { _id: 1, count: '$count' } }, { $project: { _id: 1, count: '$count' } },
]; ];
@ -244,7 +244,7 @@ module.exports = function (db, module) {
return callback(); return callback();
} }
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').findOne({_key: key, value: value}, {fields:{_id: 0, score: 1}}, function (err, result) { db.collection('objects').findOne({_key: key, value: value}, {fields: {_id: 0, score: 1}}, function (err, result) {
callback(err, result ? result.score : null); callback(err, result ? result.score : null);
}); });
}; };
@ -254,7 +254,7 @@ module.exports = function (db, module) {
return callback(); return callback();
} }
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').find({_key:{$in:keys}, value: value}, {_id:0, _key:1, score: 1}).toArray(function (err, result) { db.collection('objects').find({_key: {$in: keys}, value: value}, {_id: 0, _key: 1, score: 1}).toArray(function (err, result) {
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -15,7 +15,7 @@ module.exports = function (db, module) {
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').update({_key: key, value: value}, {$set: {score: parseFloat(score)}}, {upsert:true, w: 1}, function (err) { db.collection('objects').update({_key: key, value: value}, {$set: {score: parseFloat(score)}}, {upsert: true, w: 1}, function (err) {
if (err && err.message.startsWith('E11000 duplicate key error')) { if (err && err.message.startsWith('E11000 duplicate key error')) {
return process.nextTick(module.sortedSetAdd, key, score, value, callback); return process.nextTick(module.sortedSetAdd, key, score, value, callback);
} }

@ -263,12 +263,12 @@ function createAdmin(callback) {
winston.warn("Passwords did not match, please try again"); winston.warn("Passwords did not match, please try again");
return retryPassword(results); return retryPassword(results);
} }
if (results.password.length < meta.config.minimumPasswordLength) { if (results.password.length < meta.config.minimumPasswordLength) {
winston.warn("Password too short, please try again"); winston.warn("Password too short, please try again");
return retryPassword(results); return retryPassword(results);
} }
var adminUid; var adminUid;
async.waterfall([ async.waterfall([
function (next) { function (next) {

@ -17,13 +17,13 @@ var opts = {
/* /*
* state used by Logger * state used by Logger
*/ */
express : { express: {
app : {}, app: {},
set : 0, set: 0,
ofn : null, ofn: null,
}, },
streams : { streams: {
log : { f : process.stdout }, log: { f: process.stdout },
}, },
}; };
@ -124,7 +124,7 @@ var opts = {
/* /*
* Always initialize "ofn" (original function) with the original logger function * Always initialize "ofn" (original function) with the original logger function
*/ */
opts.express.ofn = morgan('combined', {stream : opts.streams.log.f}); opts.express.ofn = morgan('combined', {stream: opts.streams.log.f});
}; };
Logger.expressLogger = function (req,res,next) { Logger.expressLogger = function (req,res,next) {

@ -25,7 +25,7 @@ module.exports = function (Meta) {
if (err) { if (err) {
return next(err); return next(err);
} }
config['cache-buster'] = 'v=' + (buster || Date.now()); config['cache-buster'] = 'v=' + (buster || Date.now());
Meta.config = config; Meta.config = config;

@ -89,7 +89,7 @@ module.exports = function (Meta) {
}, },
}, },
}; };
Meta.js.linkModules = function (callback) { Meta.js.linkModules = function (callback) {
rimraf(path.join(__dirname, '../../build/public/src/modules'), function (err) { rimraf(path.join(__dirname, '../../build/public/src/modules'), function (err) {
if (err) { if (err) {

@ -82,7 +82,7 @@ function resetSettings(callback) {
function resetTheme(themeId, callback) { function resetTheme(themeId, callback) {
var meta = require('./meta'); var meta = require('./meta');
var fs = require('fs'); var fs = require('fs');
fs.access('node_modules/' + themeId + '/package.json', function (err, fd) { fs.access('node_modules/' + themeId + '/package.json', function (err, fd) {
if (err) { if (err) {
winston.warn('[reset] Theme `%s` is not installed on this forum', themeId); winston.warn('[reset] Theme `%s` is not installed on this forum', themeId);
@ -99,7 +99,7 @@ function resetTheme(themeId, callback) {
} }
callback(); callback();
}); });
} }
}); });
} }

@ -154,7 +154,7 @@ module.exports = function (app, middleware, hotswapIds) {
if (path.resolve(__dirname, '../../public/uploads') !== nconf.get('upload_path')) { if (path.resolve(__dirname, '../../public/uploads') !== nconf.get('upload_path')) {
statics.unshift({ route: '/assets/uploads', path: nconf.get('upload_path') }); statics.unshift({ route: '/assets/uploads', path: nconf.get('upload_path') });
} }
statics.forEach(function (obj) { statics.forEach(function (obj) {
app.use(relativePath + obj.route, express.static(obj.path, staticOptions)); app.use(relativePath + obj.route, express.static(obj.path, staticOptions));
}); });
@ -180,7 +180,7 @@ module.exports = function (app, middleware, hotswapIds) {
]; ];
app.use(relativePath, function (req, res, next) { app.use(relativePath, function (req, res, next) {
if (deprecatedPaths.some(function (path) { return req.path.startsWith(path); })) { if (deprecatedPaths.some(function (path) { return req.path.startsWith(path); })) {
winston.warn('[deprecated] Accessing `' + req.path.slice(1) + '` from `/` is deprecated. ' + winston.warn('[deprecated] Accessing `' + req.path.slice(1) + '` from `/` is deprecated. ' +
'Use `/assets' + req.path + '` to access this file.'); 'Use `/assets' + req.path + '` to access this file.');
res.redirect(relativePath + '/assets' + req.path + '?' + meta.config['cache-buster']); res.redirect(relativePath + '/assets' + req.path + '?' + meta.config['cache-buster']);
} else { } else {

@ -37,7 +37,7 @@ module.exports = function (SocketUser) {
}, },
], callback); ], callback);
}; };
SocketUser.uploadCroppedPicture = function (socket, data, callback) { SocketUser.uploadCroppedPicture = function (socket, data, callback) {
if (!socket.uid) { if (!socket.uid) {
return callback(new Error('[[error:no-privileges]]')); return callback(new Error('[[error:no-privileges]]'));

@ -19,7 +19,7 @@ module.exports = function (Topics) {
Topics.getRecentTopics = function (cid, uid, start, stop, filter, callback) { Topics.getRecentTopics = function (cid, uid, start, stop, filter, callback) {
var recentTopics = { var recentTopics = {
nextStart : 0, nextStart: 0,
topics: [], topics: [],
}; };

@ -225,7 +225,7 @@ module.exports = function (Topics) {
var uniqueCids = _.unique(topicData.map(function (topicData) { var uniqueCids = _.unique(topicData.map(function (topicData) {
return topicData && parseInt(topicData.cid, 10); return topicData && parseInt(topicData.cid, 10);
})); }));
if (uniqueCids.length > 1 || !uniqueCids.length || !uniqueCids[0]) { if (uniqueCids.length > 1 || !uniqueCids.length || !uniqueCids[0]) {
return next(new Error('[[error:invalid-data]]')); return next(new Error('[[error:invalid-data]]'));
} }
@ -249,7 +249,7 @@ module.exports = function (Topics) {
setImmediate(next); setImmediate(next);
} }
}, },
], next); ], next);
}, next); }, next);
}, },
], callback); ], callback);

@ -28,7 +28,7 @@ module.exports = function (Topics) {
var unreadTopics = { var unreadTopics = {
showSelect: true, showSelect: true,
nextStart : 0, nextStart: 0,
topics: [], topics: [],
}; };

@ -276,7 +276,7 @@ var meta = require('./meta');
callback(); callback();
}); });
}; };
User.isAdminOrGlobalModOrSelf = function (callerUid, uid, callback) { User.isAdminOrGlobalModOrSelf = function (callerUid, uid, callback) {
if (parseInt(callerUid, 10) === parseInt(uid, 10)) { if (parseInt(callerUid, 10) === parseInt(uid, 10)) {
return callback(); return callback();

@ -75,7 +75,7 @@ module.exports = function (User) {
async.parallel([ async.parallel([
async.apply(db.sortedSetRemove.bind(db), 'users:banned:expire', uid), async.apply(db.sortedSetRemove.bind(db), 'users:banned:expire', uid),
async.apply(db.sortedSetRemove.bind(db), 'users:banned', uid), async.apply(db.sortedSetRemove.bind(db), 'users:banned', uid),
async.apply(User.setUserFields, uid, {banned:0, 'banned:expire': 0}), async.apply(User.setUserFields, uid, {banned: 0, 'banned:expire': 0}),
], function (err) { ], function (err) {
next(err, false); next(err, false);
}); });

@ -63,7 +63,7 @@ module.exports = function (User) {
callback(); callback();
} }
}; };
}; };

@ -222,7 +222,7 @@ module.exports = function (User) {
} }
}); });
}; };
User.uploadCroppedPicture = function (data, callback) { User.uploadCroppedPicture = function (data, callback) {
var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1; var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1;
var url; var url;
@ -231,7 +231,7 @@ module.exports = function (User) {
if (!data.imageData) { if (!data.imageData) {
return callback(new Error('[[error:invalid-data]]')); return callback(new Error('[[error:invalid-data]]'));
} }
async.waterfall([ async.waterfall([
function (next) { function (next) {
var size = data.file ? data.file.size : data.imageData.length; var size = data.file ? data.file.size : data.imageData.length;

@ -120,7 +120,7 @@ module.exports = function (User) {
restrictChat: data.restrictChat, restrictChat: data.restrictChat,
topicSearchEnabled: data.topicSearchEnabled, topicSearchEnabled: data.topicSearchEnabled,
delayImageLoading: data.delayImageLoading, delayImageLoading: data.delayImageLoading,
homePageRoute : ((data.homePageRoute === 'custom' ? data.homePageCustom : data.homePageRoute) || '').replace(/^\//, ''), homePageRoute: ((data.homePageRoute === 'custom' ? data.homePageCustom : data.homePageRoute) || '').replace(/^\//, ''),
scrollToMyPost: data.scrollToMyPost, scrollToMyPost: data.scrollToMyPost,
notificationSound: data.notificationSound, notificationSound: data.notificationSound,
incomingChatSound: data.incomingChatSound, incomingChatSound: data.incomingChatSound,

@ -161,7 +161,7 @@ describe('Hash methods', function () {
describe('getObjectsFields()', function () { describe('getObjectsFields()', function () {
before(function (done) { before(function (done) {
async.parallel([ async.parallel([
async.apply(db.setObject, 'testObject8', {name: 'baris', age:99}), async.apply(db.setObject, 'testObject8', {name: 'baris', age: 99}),
async.apply(db.setObject, 'testObject9', {name: 'ginger', age: 3}), async.apply(db.setObject, 'testObject9', {name: 'ginger', age: 3}),
], done); ], done);
}); });

@ -5,7 +5,7 @@
(function (module) { (function (module) {
'use strict'; 'use strict';
var async = require('async'); var async = require('async');
var winston = require('winston'); var winston = require('winston');

@ -173,7 +173,7 @@ describe('Translator.create()', function () {
describe('Translator modules', function () { describe('Translator modules', function () {
it('should work before registered', function () { it('should work before registered', function () {
var translator = Translator.create(); var translator = Translator.create();
Translator.registerModule('test-custom-integer-format', function (lang) { Translator.registerModule('test-custom-integer-format', function (lang) {
return function (key, args) { return function (key, args) {
var num = parseInt(args[0], 10) || 0; var num = parseInt(args[0], 10) || 0;

@ -155,7 +155,7 @@ describe('User', function () {
it('should not error if a non-newbie user posts if the last post time is 10 < 30 seconds', function (done) { it('should not error if a non-newbie user posts if the last post time is 10 < 30 seconds', function (done) {
User.setUserFields(testUid, { User.setUserFields(testUid, {
lastposttime: +new Date() - (20 * 1000), lastposttime: +new Date() - (20 * 1000),
reputation: 10, reputation: 10,
}, function () { }, function () {
Topics.post({ Topics.post({
@ -508,7 +508,7 @@ describe('User', function () {
done(); done();
}); });
}); });
it('should return error if profile image uploads disabled', function (done) { it('should return error if profile image uploads disabled', function (done) {
meta.config.allowProfileImageUploads = 0; meta.config.allowProfileImageUploads = 0;
var path = require('path'); var path = require('path');
@ -522,7 +522,7 @@ describe('User', function () {
done(); done();
}); });
}); });
it('should return error if profile image is too big', function (done) { it('should return error if profile image is too big', function (done) {
meta.config.allowProfileImageUploads = 1; meta.config.allowProfileImageUploads = 1;
var path = require('path'); var path = require('path');
@ -536,7 +536,7 @@ describe('User', function () {
done(); done();
}); });
}); });
it('should return error if profile image file has no extension', function (done) { it('should return error if profile image file has no extension', function (done) {
var path = require('path'); var path = require('path');
var picture = { var picture = {
@ -549,7 +549,7 @@ describe('User', function () {
done(); done();
}); });
}); });
it('should return error if no plugins listening for filter:uploadImage when uploading from url', function (done) { it('should return error if no plugins listening for filter:uploadImage when uploading from url', function (done) {
var url = nconf.get('url') + '/logo.png'; var url = nconf.get('url') + '/logo.png';
User.uploadFromUrl(uid, url, function (err, uploadedPicture) { User.uploadFromUrl(uid, url, function (err, uploadedPicture) {
@ -557,51 +557,51 @@ describe('User', function () {
done(); done();
}); });
}); });
it('should return error if the extension is invalid when uploading from url', function (done) { it('should return error if the extension is invalid when uploading from url', function (done) {
var url = nconf.get('url') + '/favicon.ico'; var url = nconf.get('url') + '/favicon.ico';
function filterMethod(data, callback) { function filterMethod(data, callback) {
data.foo += 5; data.foo += 5;
callback(null, data); callback(null, data);
} }
plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod}); plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod});
User.uploadFromUrl(uid, url, function (err, uploadedPicture) { User.uploadFromUrl(uid, url, function (err, uploadedPicture) {
assert.equal(err.message, '[[error:invalid-image-extension]]'); assert.equal(err.message, '[[error:invalid-image-extension]]');
done(); done();
}); });
}); });
it('should return error if the file is too big when uploading from url', function (done) { it('should return error if the file is too big when uploading from url', function (done) {
var url = nconf.get('url') + '/logo.png'; var url = nconf.get('url') + '/logo.png';
meta.config.maximumProfileImageSize = 1; meta.config.maximumProfileImageSize = 1;
function filterMethod(data, callback) { function filterMethod(data, callback) {
data.foo += 5; data.foo += 5;
callback(null, data); callback(null, data);
} }
plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod}); plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod});
User.uploadFromUrl(uid, url, function (err, uploadedPicture) { User.uploadFromUrl(uid, url, function (err, uploadedPicture) {
assert.equal(err.message, '[[error:file-too-big, ' + meta.config.maximumProfileImageSize + ']]'); assert.equal(err.message, '[[error:file-too-big, ' + meta.config.maximumProfileImageSize + ']]');
done(); done();
}); });
}); });
it('should upload picture when uploading from url', function (done) { it('should upload picture when uploading from url', function (done) {
var url = nconf.get('url') + '/logo.png'; var url = nconf.get('url') + '/logo.png';
meta.config.maximumProfileImageSize = ''; meta.config.maximumProfileImageSize = '';
function filterMethod(data, callback) { function filterMethod(data, callback) {
data.foo += 5; data.foo += 5;
callback(null, {url: url}); callback(null, {url: url});
} }
plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod}); plugins.registerHook('test-plugin', {hook: 'filter:uploadImage', method: filterMethod});
User.uploadFromUrl(uid, url, function (err, uploadedPicture) { User.uploadFromUrl(uid, url, function (err, uploadedPicture) {
assert.ifError(err); assert.ifError(err);
assert.equal(uploadedPicture.url, url); assert.equal(uploadedPicture.url, url);

Loading…
Cancel
Save