ESlint no-unused-vars

v1.18.x
Peter Jaszkowiak 8 years ago
parent c18808fdeb
commit 4bb49a7171

@ -62,7 +62,7 @@
"no-mixed-requires": "off", "no-mixed-requires": "off",
// "brace-style": "off", // "brace-style": "off",
"max-statements-per-line": "off", "max-statements-per-line": "off",
"no-unused-vars": "off", // "no-unused-vars": "off",
// "no-mixed-spaces-and-tabs": "off", // "no-mixed-spaces-and-tabs": "off",
// "no-useless-concat": "off", // "no-useless-concat": "off",
// "require-jsdoc": "off", // "require-jsdoc": "off",

@ -16,7 +16,6 @@ module.exports = function (grunt) {
function update(action, filepath, target) { function update(action, filepath, target) {
var updateArgs = args.slice(); var updateArgs = args.slice();
var fromFile = '';
var compiling = ''; var compiling = '';
var time = Date.now(); var time = Date.now();

@ -237,6 +237,6 @@ fs.open(path.join(__dirname, 'config.json'), 'r', function (err) {
}); });
} else { } else {
// No config detected, kickstart web installer // No config detected, kickstart web installer
var child = require('child_process').fork('app'); require('child_process').fork('app');
} }
}); });

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/advanced/errors', ['Chart', 'translator'], function (Chart, translator) { define('admin/advanced/errors', ['Chart'], function (Chart) {
var Errors = {}; var Errors = {};
Errors.init = function () { Errors.init = function () {

@ -10,7 +10,7 @@ define('admin/advanced/logs', function () {
// Affix menu // Affix menu
$('.affix').affix(); $('.affix').affix();
$('.logs').find('button[data-action]').on('click', function (event) { $('.logs').find('button[data-action]').on('click', function () {
var btnEl = $(this); var btnEl = $(this);
var action = btnEl.attr('data-action'); var action = btnEl.attr('data-action');

@ -15,7 +15,7 @@ define('admin/appearance/customise', ['admin/settings'], function (Settings) {
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 () {
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());
@ -24,7 +24,7 @@ define('admin/appearance/customise', ['admin/settings'], function (Settings) {
customHTML.setTheme('ace/theme/twilight'); customHTML.setTheme('ace/theme/twilight');
customHTML.getSession().setMode('ace/mode/html'); customHTML.getSession().setMode('ace/mode/html');
customHTML.on('change', function (event) { customHTML.on('change', function () {
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());

@ -71,21 +71,19 @@ define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, t
return; return;
} }
require(['semver'], function (semver) { if (payload.version !== 'latest') {
if (payload.version !== 'latest') { Plugins.toggleInstall(pluginID, payload.version);
Plugins.toggleInstall(pluginID, payload.version); } else if (payload.version === 'latest') {
} else if (payload.version === 'latest') { confirmInstall(pluginID, function (confirm) {
confirmInstall(pluginID, function (confirm) { if (confirm) {
if (confirm) { Plugins.toggleInstall(pluginID, 'latest');
Plugins.toggleInstall(pluginID, 'latest'); } else {
} else { btn.removeAttr('disabled');
btn.removeAttr('disabled'); }
} });
}); } else {
} else { btn.removeAttr('disabled');
btn.removeAttr('disabled'); }
}
});
}); });
}); });
@ -198,7 +196,6 @@ define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, t
Plugins.toggleInstall = function (pluginID, version, callback) { Plugins.toggleInstall = function (pluginID, version, callback) {
var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]'); var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]');
var activateBtn = btn.siblings('[data-action="toggleActive"]');
btn.find('i').attr('class', 'fa fa-refresh fa-spin'); btn.find('i').attr('class', 'fa fa-refresh fa-spin');
socket.emit('admin.plugins.toggleInstall', { socket.emit('admin.plugins.toggleInstall', {

@ -42,7 +42,6 @@ define('admin/extend/rewards', ['translator'], function (translator) {
.on('click', '.toggle', function () { .on('click', '.toggle', function () {
var btn = $(this); var btn = $(this);
var disabled = btn.hasClass('btn-success'); var disabled = btn.hasClass('btn-success');
var id = $(this).parents('[data-id]').attr('data-id');
btn.toggleClass('btn-warning').toggleClass('btn-success').translateHtml('[[admin/extend/rewards:' + (disabled ? 'disable' : 'enable') + ']]'); btn.toggleClass('btn-warning').toggleClass('btn-success').translateHtml('[[admin/extend/rewards:' + (disabled ? 'disable' : 'enable') + ']]');
// send disable api call // send disable api call
return false; return false;

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { define('admin/extend/widgets', ['jqueryui'], function () {
var Widgets = {}; var Widgets = {};
Widgets.init = function () { Widgets.init = function () {

@ -24,7 +24,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
realtimeInterval: 1500, realtimeInterval: 1500,
}; };
$(window).on('action:ajaxify.start', function (ev, data) { $(window).on('action:ajaxify.start', function () {
clearInterval(intervals.rooms); clearInterval(intervals.rooms);
clearInterval(intervals.graphs); clearInterval(intervals.graphs);

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/general/homepage', ['admin/settings'], function (Settings) { define('admin/general/homepage', ['admin/settings'], function () {
function toggleCustomRoute() { function toggleCustomRoute() {
if ($('[data-field="homePageRoute"]').val()) { if ($('[data-field="homePageRoute"]').val()) {
$('#homePageCustom').hide(); $('#homePageCustom').hide();

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], function (translator, iconSelect, jqueryui) { define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], function (translator, iconSelect) {
var navigation = {}; var navigation = {};
var available; var available;

@ -26,32 +26,6 @@ define('admin/manage/category', [
} }
} }
function save(e) {
e.preventDefault();
if (Object.keys(modified_categories).length) {
socket.emit('admin.categories.update', modified_categories, function (err, results) {
if (err) {
return app.alertError(err.message);
}
if (results && results.length) {
app.flags._unsaved = false;
app.alert({
title: '[[admin/manage/categories:alert.updated]]',
message: translator.compile(
'admin/manage/categories:alert.updated-success',
results.join(', ')
),
type: 'success',
timeout: 2000,
});
}
});
modified_categories = {};
}
}
$('.blockclass, form.category select').each(function () { $('.blockclass, form.category select').each(function () {
var $this = $(this); var $this = $(this);
$this.val($this.attr('data-value')); $this.val($this.attr('data-value'));
@ -226,7 +200,7 @@ define('admin/manage/category', [
ajaxify.data.category.tagWhitelist.forEach(function (tag) { ajaxify.data.category.tagWhitelist.forEach(function (tag) {
tagEl.tagsinput('add', tag); tagEl.tagsinput('add', tag);
}); });
tagEl.on('itemAdded itemRemoved', function (event) { tagEl.on('itemAdded itemRemoved', function () {
modified(tagEl); modified(tagEl);
}); });
} }

@ -32,7 +32,6 @@ define('admin/manage/groups', ['translator'], function (translator) {
name: createGroupName.val(), name: createGroupName.val(),
description: $('#create-group-desc').val(), description: $('#create-group-desc').val(),
}; };
var errorText;
socket.emit('admin.groups.create', submitObj, function (err) { socket.emit('admin.groups.create', submitObj, function (err) {
if (err) { if (err) {
@ -62,7 +61,7 @@ define('admin/manage/groups', ['translator'], function (translator) {
if (confirm) { if (confirm) {
socket.emit('groups.delete', { socket.emit('groups.delete', {
groupName: groupName, groupName: groupName,
}, function (err, data) { }, function (err) {
if (err) { if (err) {
return app.alertError(err.message); return app.alertError(err.message);
} }

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/manage/ip-blacklist', ['translator'], function (translator) { define('admin/manage/ip-blacklist', [], function () {
var Blacklist = {}; var Blacklist = {};
Blacklist.init = function () { Blacklist.init = function () {

@ -5,7 +5,7 @@ define('admin/manage/registration', function () {
var Registration = {}; var Registration = {};
Registration.init = function () { Registration.init = function () {
$('.users-list').on('click', '[data-action]', function (ev) { $('.users-list').on('click', '[data-action]', function () {
var parent = $(this).parents('[data-username]'); var parent = $(this).parents('[data-username]');
var action = $(this).attr('data-action'); var action = $(this).attr('data-action');
var username = parent.attr('data-username'); var username = parent.attr('data-username');
@ -20,7 +20,7 @@ define('admin/manage/registration', function () {
return false; return false;
}); });
$('.invites-list').on('click', '[data-action]', function (ev) { $('.invites-list').on('click', '[data-action]', function () {
var parent = $(this).parents('[data-invitation-mail][data-invited-by]'); var parent = $(this).parents('[data-invitation-mail][data-invited-by]');
var email = parent.attr('data-invitation-mail'); var email = parent.attr('data-invitation-mail');
var invitedBy = parent.attr('data-invited-by'); var invitedBy = parent.attr('data-invited-by');

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/modules/selectable', ['jqueryui'], function (jqueryui) { define('admin/modules/selectable', ['jqueryui'], function () {
var selectable = {}; var selectable = {};
selectable.enable = function (containerEl, targets) { selectable.enable = function (containerEl, targets) {

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/settings/email', ['admin/settings'], function (settings) { define('admin/settings/email', ['admin/settings'], function () {
var module = {}; var module = {};
var emailEditor; var emailEditor;

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('admin/settings/general', ['admin/settings'], function (Settings) { define('admin/settings/general', ['admin/settings'], function () {
var Module = {}; var Module = {};
Module.init = function () { Module.init = function () {

@ -4,9 +4,8 @@
define('forum/account/profile', [ define('forum/account/profile', [
'forum/account/header', 'forum/account/header',
'forum/infinitescroll', 'forum/infinitescroll',
'translator',
'components', 'components',
], function (header, infinitescroll, translator) { ], function (header, infinitescroll) {
var Account = {}; var Account = {};
var theirid; var theirid;

@ -3,7 +3,6 @@
define('forum/account/topics', ['forum/account/header', 'forum/infinitescroll'], function (header, infinitescroll) { define('forum/account/topics', ['forum/account/header', 'forum/infinitescroll'], function (header, infinitescroll) {
var AccountTopics = {}; var AccountTopics = {};
var template;
var set; var set;
AccountTopics.init = function () { AccountTopics.init = function () {
@ -13,7 +12,6 @@ define('forum/account/topics', ['forum/account/header', 'forum/infinitescroll'],
}; };
AccountTopics.handleInfiniteScroll = function (_template, _set) { AccountTopics.handleInfiniteScroll = function (_template, _set) {
template = _template;
set = _set; set = _set;
if (!config.usePagination) { if (!config.usePagination) {

@ -35,7 +35,6 @@ define('forum/categories', ['components', 'translator'], function (components, t
} }
var recentPosts = category.find('[component="category/posts"]'); var recentPosts = category.find('[component="category/posts"]');
var insertBefore = recentPosts.first();
parseAndTranslate([post], function (html) { parseAndTranslate([post], function (html) {
html.hide(); html.hide();

@ -112,11 +112,11 @@ define('forum/category', [
}); });
}; };
Category.navigatorCallback = function (topIndex, bottomIndex, elementCount) { Category.navigatorCallback = function (topIndex, bottomIndex) {
return bottomIndex; return bottomIndex;
}; };
$(window).on('action:ajaxify.contentLoaded', function (ev, data) { $(window).on('action:ajaxify.contentLoaded', function () {
if (ajaxify.data.template.category && ajaxify.data.cid) { if (ajaxify.data.template.category && ajaxify.data.cid) {
var bookmarkIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark'); var bookmarkIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark');
var clickedIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark:clicked'); var clickedIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark:clicked');

@ -5,8 +5,6 @@ define('forum/groups/list', ['forum/infinitescroll'], function (infinitescroll)
var Groups = {}; var Groups = {};
Groups.init = function () { Groups.init = function () {
var groupsEl = $('#groups-list');
infinitescroll.init(Groups.loadMoreGroups); infinitescroll.init(Groups.loadMoreGroups);
// Group creation // Group creation

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('forum/groups/memberlist', ['components', 'forum/infinitescroll'], function (components, infinitescroll) { define('forum/groups/memberlist', ['components', 'forum/infinitescroll'], function () {
var MemberList = {}; var MemberList = {};
var searchInterval; var searchInterval;
var groupName; var groupName;

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('forum/login', ['translator'], function (translator) { define('forum/login', [], function () {
var Login = {}; var Login = {};
Login.init = function () { Login.init = function () {
@ -35,10 +35,10 @@ define('forum/login', ['translator'], function (translator) {
headers: { headers: {
'x-csrf-token': config.csrf_token, 'x-csrf-token': config.csrf_token,
}, },
success: function (data, status) { success: function (data) {
window.location.href = data + '?loggedin'; window.location.href = data + '?loggedin';
}, },
error: function (data, status) { error: function (data) {
if (data.status === 403 && data.responseText === 'Forbidden') { if (data.status === 403 && data.responseText === 'Forbidden') {
window.location.href = config.relative_path + '/login?error=csrf-invalid'; window.location.href = config.relative_path + '/login?error=csrf-invalid';
} else { } else {

@ -16,7 +16,7 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'],
}); });
} }
function onRepliesClicked(button, tid) { function onRepliesClicked(button) {
var post = button.closest('[data-pid]'); var post = button.closest('[data-pid]');
var pid = post.data('pid'); var pid = post.data('pid');
var open = button.children('[component="post/replies/open"]'); var open = button.children('[component="post/replies/open"]');

@ -75,7 +75,7 @@ $('document').ready(function () {
} }
} }
function validateConfirmPassword(field) { function validateConfirmPassword() {
if ($('[name="admin:password"]').val() !== $('[name="admin:passwordConfirm"]').val()) { if ($('[name="admin:password"]').val() !== $('[name="admin:passwordConfirm"]').val()) {
parent.addClass('error'); parent.addClass('error');
help.html('Passwords do not match.'); help.html('Passwords do not match.');
@ -116,7 +116,7 @@ $('document').ready(function () {
$.post('/launch', function () { $.post('/launch', function () {
setInterval(function () { setInterval(function () {
$.get('/admin').done(function (data) { $.get('/admin').done(function () {
window.location = 'admin'; window.location = 'admin';
}); });
}, 750); }, 750);

@ -44,7 +44,7 @@ define('iconSelect', function () {
success: { success: {
label: 'Select', label: 'Select',
className: 'btn-primary', className: 'btn-primary',
callback: function (confirm) { callback: function () {
var iconClass = $('.bootbox .selected').attr('class'); var iconClass = $('.bootbox .selected').attr('class');
var categoryIconClass = $('<div/>').addClass(iconClass).removeClass('fa').removeClass('selected').attr('class'); var categoryIconClass = $('<div/>').addClass(iconClass).removeClass('fa').removeClass('selected').attr('class');

@ -85,7 +85,7 @@ define('search', ['navigator', 'translator'], function (nav, translator) {
} }
}; };
Search.queryTopic = function (tid, term, callback) { Search.queryTopic = function (tid, term) {
socket.emit('topics.search', { socket.emit('topics.search', {
tid: tid, tid: tid,
term: term, term: term,

@ -1,7 +1,6 @@
'use strict'; 'use strict';
define('settings/array', function () { define('settings/array', function () {
var Settings = null;
var SettingsArray; var SettingsArray;
var helper = null; var helper = null;
@ -95,7 +94,7 @@ define('settings/array', function () {
SettingsArray = { SettingsArray = {
types: ['array', 'div'], types: ['array', 'div'],
use: function () { use: function () {
helper = (Settings = this).helper; helper = this.helper;
}, },
create: function (ignored, tagName) { create: function (ignored, tagName) {
return helper.createElement(tagName || 'div'); return helper.createElement(tagName || 'div');

@ -1,7 +1,6 @@
'use strict'; 'use strict';
define('settings/key', function () { define('settings/key', function () {
var Settings = null;
var SettingsKey; var SettingsKey;
var helper = null; var helper = null;
var lastKey = null; var lastKey = null;
@ -182,7 +181,7 @@ define('settings/key', function () {
SettingsKey = { SettingsKey = {
types: ['key'], types: ['key'],
use: function () { use: function () {
helper = (Settings = this).helper; helper = this.helper;
}, },
init: function (element) { init: function (element) {
element.focus(function () { element.focus(function () {

@ -1,7 +1,6 @@
'use strict'; 'use strict';
define('settings/object', function () { define('settings/object', function () {
var Settings = null;
var SettingsObject; var SettingsObject;
var helper = null; var helper = null;
@ -57,7 +56,7 @@ define('settings/object', function () {
SettingsObject = { SettingsObject = {
types: ['object'], types: ['object'],
use: function () { use: function () {
helper = (Settings = this).helper; helper = this.helper;
}, },
create: function (ignored, tagName) { create: function (ignored, tagName) {
return helper.createElement(tagName || 'div'); return helper.createElement(tagName || 'div');

@ -1,7 +1,5 @@
'use strict'; 'use strict';
var async = require('async');
var db = require('../database'); var db = require('../database');
module.exports = function (Categories) { module.exports = function (Categories) {

@ -2,7 +2,7 @@
var appearanceController = {}; var appearanceController = {};
appearanceController.get = function (req, res, next) { appearanceController.get = function (req, res) {
var term = req.params.term ? req.params.term : 'themes'; var term = req.params.term ? req.params.term : 'themes';
res.render('admin/appearance/' + term, {}); res.render('admin/appearance/' + term, {});

@ -2,7 +2,7 @@
var cacheController = {}; var cacheController = {};
cacheController.get = function (req, res, next) { cacheController.get = function (req, res) {
var postCache = require('../../posts/cache'); var postCache = require('../../posts/cache');
var groupCache = require('../../groups').cache; var groupCache = require('../../groups').cache;

@ -38,7 +38,7 @@ categoriesController.get = function (req, res, next) {
}); });
}; };
categoriesController.getAll = function (req, res, next) { categoriesController.getAll = function (req, res) {
// Categories list will be rendered on client side with recursion, etc. // Categories list will be rendered on client side with recursion, etc.
res.render('admin/manage/categories', {}); res.render('admin/manage/categories', {});
}; };

@ -6,12 +6,9 @@ var db = require('../../database');
var groups = require('../../groups'); var groups = require('../../groups');
var meta = require('../../meta'); var meta = require('../../meta');
var pagination = require('../../pagination'); var pagination = require('../../pagination');
var helpers = require('../helpers');
var groupsController = {}; var groupsController = {};
groupsController.list = function (req, res, next) { groupsController.list = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1; var page = parseInt(req.query.page, 10) || 1;
var groupsPerPage = 20; var groupsPerPage = 20;

@ -13,7 +13,7 @@ var infoController = {};
var info = {}; var info = {};
infoController.get = function (req, res, next) { infoController.get = function (req, res) {
info = {}; info = {};
pubsub.publish('sync:node:info:start'); pubsub.publish('sync:node:info:start');
setTimeout(function () { setTimeout(function () {

@ -15,7 +15,7 @@ var usersController = {};
var userFields = ['uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned', var userFields = ['uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned',
'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed']; 'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed'];
usersController.search = function (req, res, next) { usersController.search = function (req, res) {
res.render('admin/manage/users', { res.render('admin/manage/users', {
search_display: '', search_display: '',
users: [], users: [],

@ -6,7 +6,6 @@ var passport = require('passport');
var nconf = require('nconf'); var nconf = require('nconf');
var validator = require('validator'); var validator = require('validator');
var _ = require('underscore'); var _ = require('underscore');
var url = require('url');
var db = require('../database'); var db = require('../database');
var meta = require('../meta'); var meta = require('../meta');
@ -19,7 +18,7 @@ var sockets = require('../socket.io');
var authenticationController = {}; var authenticationController = {};
authenticationController.register = function (req, res, next) { authenticationController.register = function (req, res) {
var registrationType = meta.config.registrationType || 'normal'; var registrationType = meta.config.registrationType || 'normal';
if (registrationType === 'disabled') { if (registrationType === 'disabled') {

@ -18,7 +18,7 @@ helpers.notAllowed = function (req, res, error) {
req: req, req: req,
res: res, res: res,
error: error, error: error,
}, function (err, data) { }, function (err) {
if (err) { if (err) {
return winston.error(err); return winston.error(err);
} }

@ -416,7 +416,7 @@ Controllers.handleURIErrors = function (err, req, res, next) {
} }
}; };
Controllers.handleErrors = function (err, req, res, next) { Controllers.handleErrors = function (err, req, res) {
switch (err.code) { switch (err.code) {
case 'EBADCSRFTOKEN': case 'EBADCSRFTOKEN':
winston.error(req.path + '\n', err.message); winston.error(req.path + '\n', err.message);

@ -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) {
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) {
callback(err); callback(err);
}); });
}; };
@ -48,7 +48,7 @@ module.exports = function (db, module) {
return callback(err); return callback(err);
} }
db.collection('objects').update({ _key: key }, { $pop: { array: 1 } }, function (err, result) { db.collection('objects').update({ _key: key }, { $pop: { array: 1 } }, function (err) {
callback(err, (value && value.length) ? value[0] : null); callback(err, (value && value.length) ? value[0] : null);
}); });
}); });
@ -61,7 +61,7 @@ module.exports = function (db, module) {
} }
value = helpers.valueToString(value); value = helpers.valueToString(value);
db.collection('objects').update({ _key: key }, { $pull: { array: value } }, function (err, res) { db.collection('objects').update({ _key: key }, { $pull: { array: value } }, function (err) {
callback(err); callback(err);
}); });
}; };
@ -76,7 +76,7 @@ module.exports = function (db, module) {
return callback(err); return callback(err);
} }
db.collection('objects').update({ _key: key }, { $set: { array: value } }, function (err, res) { db.collection('objects').update({ _key: key }, { $set: { array: value } }, function (err) {
callback(err); callback(err);
}); });
}); });

@ -1,7 +1,5 @@
'use strict'; 'use strict';
var winston = require('winston');
module.exports = function (db, module) { module.exports = function (db, module) {
var helpers = module.helpers.mongo; var helpers = module.helpers.mongo;
@ -33,7 +31,7 @@ module.exports = function (db, module) {
if (!key) { if (!key) {
return callback(); return callback();
} }
db.collection('objects').remove({ _key: key }, function (err, res) { db.collection('objects').remove({ _key: key }, function (err) {
callback(err); callback(err);
}); });
}; };
@ -43,7 +41,7 @@ module.exports = function (db, module) {
if (!Array.isArray(keys) || !keys.length) { if (!Array.isArray(keys) || !keys.length) {
return callback(); return callback();
} }
db.collection('objects').remove({ _key: { $in: keys } }, function (err, res) { db.collection('objects').remove({ _key: { $in: keys } }, function (err) {
callback(err); callback(err);
}); });
}; };
@ -76,7 +74,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) {
callback(err); callback(err);
}); });
}; };

@ -24,7 +24,7 @@ module.exports = function (db, module) {
}, { }, {
upsert: true, upsert: true,
w: 1, w: 1,
}, function (err, res) { }, function (err) {
callback(err); callback(err);
}); });
}; };
@ -54,7 +54,7 @@ module.exports = function (db, module) {
} }); } });
} }
bulk.execute(function (err, res) { bulk.execute(function (err) {
callback(err); callback(err);
}); });
}; };
@ -69,7 +69,7 @@ module.exports = function (db, module) {
array[index] = helpers.valueToString(element); array[index] = helpers.valueToString(element);
}); });
db.collection('objects').update({ _key: key }, { $pullAll: { members: value } }, function (err, res) { db.collection('objects').update({ _key: key }, { $pullAll: { members: value } }, function (err) {
callback(err); callback(err);
}); });
}; };
@ -89,7 +89,7 @@ module.exports = function (db, module) {
} }); } });
} }
bulk.execute(function (err, res) { bulk.execute(function (err) {
callback(err); callback(err);
}); });
}; };

@ -6,7 +6,6 @@
var semver = require('semver'); var semver = require('semver');
var session = require('express-session'); var session = require('express-session');
var redis; var redis;
var connectRedis;
var redisClient; var redisClient;
module.questions = [ module.questions = [

@ -96,13 +96,13 @@ module.exports = function (redisClient, module) {
module.deleteObjectField = function (key, field, callback) { module.deleteObjectField = function (key, field, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.hdel(key, field, function (err, res) { redisClient.hdel(key, field, function (err) {
callback(err); callback(err);
}); });
}; };
module.deleteObjectFields = function (key, fields, callback) { module.deleteObjectFields = function (key, fields, callback) {
helpers.multiKeyValues(redisClient, 'hdel', key, fields, function (err, results) { helpers.multiKeyValues(redisClient, 'hdel', key, fields, function (err) {
callback(err); callback(err);
}); });
}; };

@ -3,14 +3,14 @@
module.exports = function (redisClient, module) { module.exports = function (redisClient, module) {
module.listPrepend = function (key, value, callback) { module.listPrepend = function (key, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.lpush(key, value, function (err, res) { redisClient.lpush(key, value, function (err) {
callback(err); callback(err);
}); });
}; };
module.listAppend = function (key, value, callback) { module.listAppend = function (key, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.rpush(key, value, function (err, res) { redisClient.rpush(key, value, function (err) {
callback(err); callback(err);
}); });
}; };
@ -22,14 +22,14 @@ module.exports = function (redisClient, module) {
module.listRemoveAll = function (key, value, callback) { module.listRemoveAll = function (key, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.lrem(key, 0, value, function (err, res) { redisClient.lrem(key, 0, value, function (err) {
callback(err); callback(err);
}); });
}; };
module.listTrim = function (key, start, stop, callback) { module.listTrim = function (key, start, stop, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.ltrim(key, start, stop, function (err, res) { redisClient.ltrim(key, start, stop, function (err) {
callback(err); callback(err);
}); });
}; };

@ -21,7 +21,7 @@ module.exports = function (redisClient, module) {
module.delete = function (key, callback) { module.delete = function (key, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.del(key, function (err, res) { redisClient.del(key, function (err) {
callback(err); callback(err);
}); });
}; };
@ -32,7 +32,7 @@ module.exports = function (redisClient, module) {
for (var i = 0; i < keys.length; i += 1) { for (var i = 0; i < keys.length; i += 1) {
multi.del(keys[i]); multi.del(keys[i]);
} }
multi.exec(function (err, res) { multi.exec(function (err) {
callback(err); callback(err);
}); });
}; };
@ -55,7 +55,7 @@ module.exports = function (redisClient, module) {
module.rename = function (oldKey, newKey, callback) { module.rename = function (oldKey, newKey, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.rename(oldKey, newKey, function (err, res) { redisClient.rename(oldKey, newKey, function (err) {
callback(err && err.message !== 'ERR no such key' ? err : null); callback(err && err.message !== 'ERR no such key' ? err : null);
}); });
}; };

@ -11,28 +11,28 @@ module.exports = function (redisClient, module) {
if (!value.length) { if (!value.length) {
return callback(); return callback();
} }
redisClient.sadd(key, value, function (err, res) { redisClient.sadd(key, value, function (err) {
callback(err); callback(err);
}); });
}; };
module.setsAdd = function (keys, value, callback) { module.setsAdd = function (keys, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
helpers.multiKeysValue(redisClient, 'sadd', keys, value, function (err, res) { helpers.multiKeysValue(redisClient, 'sadd', keys, value, function (err) {
callback(err); callback(err);
}); });
}; };
module.setRemove = function (key, value, callback) { module.setRemove = function (key, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
redisClient.srem(key, value, function (err, res) { redisClient.srem(key, value, function (err) {
callback(err); callback(err);
}); });
}; };
module.setsRemove = function (keys, value, callback) { module.setsRemove = function (keys, value, callback) {
callback = callback || function () {}; callback = callback || function () {};
helpers.multiKeysValue(redisClient, 'srem', keys, value, function (err, res) { helpers.multiKeysValue(redisClient, 'srem', keys, value, function (err) {
callback(err); callback(err);
}); });
}; };

@ -30,7 +30,7 @@ var utils = require('../public/src/utils');
}, },
], next); ], next);
}, },
], function (err, result) { ], function (err) {
callback(err); callback(err);
}); });
}; };

@ -5,7 +5,7 @@ var fs = require('fs');
var async = require('async'); var async = require('async');
var semver = require('semver'); var semver = require('semver');
var winston = require('winston'); var winston = require('winston');
var colors = require('colors'); require('colors');
var pkg = require('../../package.json'); var pkg = require('../../package.json');
@ -47,7 +47,7 @@ module.exports = function (Meta) {
next(true); next(true);
} }
}); });
}, function (ok) { }, function () {
if (depsMissing) { if (depsMissing) {
callback(new Error('dependencies-missing')); callback(new Error('dependencies-missing'));
} else if (depsOutdated) { } else if (depsOutdated) {

@ -10,7 +10,6 @@ var ensureLoggedIn = require('connect-ensure-login');
var toobusy = require('toobusy-js'); var toobusy = require('toobusy-js');
var plugins = require('../plugins'); var plugins = require('../plugins');
var languages = require('../languages');
var meta = require('../meta'); var meta = require('../meta');
var user = require('../user'); var user = require('../user');
var groups = require('../groups'); var groups = require('../groups');
@ -181,7 +180,7 @@ middleware.applyBlacklist = function (req, res, next) {
}); });
}; };
middleware.processTimeagoLocales = function (req, res, next) { middleware.processTimeagoLocales = function (req, res) {
var fallback = req.path.indexOf('-short') === -1 ? 'jquery.timeago.en.js' : 'jquery.timeago.en-short.js'; var fallback = req.path.indexOf('-short') === -1 ? 'jquery.timeago.en.js' : 'jquery.timeago.en-short.js';
var localPath = path.join(__dirname, '../../public/vendor/jquery/timeago/locales', req.path); var localPath = path.join(__dirname, '../../public/vendor/jquery/timeago/locales', req.path);
var exists; var exists;

@ -373,7 +373,6 @@ var utils = require('../public/src/utils');
Notifications.prune = function () { Notifications.prune = function () {
var week = 604800000; var week = 604800000;
var numPruned = 0;
var cutoffTime = Date.now() - week; var cutoffTime = Date.now() - week;
@ -390,8 +389,6 @@ var utils = require('../public/src/utils');
return 'notifications:' + nid; return 'notifications:' + nid;
}); });
numPruned = nids.length;
async.parallel([ async.parallel([
function (next) { function (next) {
db.sortedSetRemove('notifications', nids, next); db.sortedSetRemove('notifications', nids, next);

@ -115,7 +115,7 @@ var middleware;
Object.keys(Plugins.loadedHooks).forEach(function (hook) { Object.keys(Plugins.loadedHooks).forEach(function (hook) {
var hooks = Plugins.loadedHooks[hook]; var hooks = Plugins.loadedHooks[hook];
hooks = hooks.sort(function (a, b) { hooks.sort(function (a, b) {
return a.priority - b.priority; return a.priority - b.priority;
}); });
}); });

@ -44,7 +44,7 @@ module.exports = function (Plugins) {
if (parts.length > 2) { if (parts.length > 2) {
parts.pop(); parts.pop();
} }
var hook = parts.join(':'); parts.join(':');
} }
if (data.hook && data.method) { if (data.hook && data.method) {

@ -80,7 +80,7 @@ module.exports = function (Plugins) {
}, },
function (active, next) { function (active, next) {
if (active) { if (active) {
Plugins.toggleActive(id, function (err, status) { Plugins.toggleActive(id, function (err) {
next(err); next(err);
}); });
return; return;

@ -221,13 +221,11 @@ module.exports = function (privileges) {
}; };
function isPostEditable(pid, uid, callback) { function isPostEditable(pid, uid, callback) {
var tid;
async.waterfall([ async.waterfall([
function (next) { function (next) {
posts.getPostFields(pid, ['tid', 'timestamp'], next); posts.getPostFields(pid, ['tid', 'timestamp'], next);
}, },
function (postData, next) { function (postData, next) {
tid = postData.tid;
var postEditDuration = parseInt(meta.config.postEditDuration, 10); var postEditDuration = parseInt(meta.config.postEditDuration, 10);
if (postEditDuration && Date.now() - parseInt(postData.timestamp, 10) > postEditDuration * 1000) { if (postEditDuration && Date.now() - parseInt(postData.timestamp, 10) > postEditDuration * 1000) {
return callback(null, { flag: false, message: '[[error:post-edit-duration-expired, ' + meta.config.postEditDuration + ']]' }); return callback(null, { flag: false, message: '[[error:post-edit-duration-expired, ' + meta.config.postEditDuration + ']]' });

@ -83,7 +83,7 @@ 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) {
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);
callback(new Error('theme-not-found')); callback(new Error('theme-not-found'));

@ -7,9 +7,8 @@ var user = require('../user');
var categories = require('../categories'); var categories = require('../categories');
var topics = require('../topics'); var topics = require('../topics');
var posts = require('../posts'); var posts = require('../posts');
var db = require('../database');
module.exports = function (app, middleware, controllers) { module.exports = function (app) {
var router = express.Router(); var router = express.Router();
router.get('/uid/:uid', function (req, res) { router.get('/uid/:uid', function (req, res) {

@ -13,7 +13,7 @@ var meta = require('../meta');
var helpers = require('../controllers/helpers'); var helpers = require('../controllers/helpers');
var privileges = require('../privileges'); var privileges = require('../privileges');
module.exports = function (app, middleware, controllers) { module.exports = function (app, middleware) {
app.get('/topic/:topic_id.rss', middleware.maintenanceMode, generateForTopic); app.get('/topic/:topic_id.rss', middleware.maintenanceMode, generateForTopic);
app.get('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory); app.get('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory);
app.get('/recent.rss', middleware.maintenanceMode, generateForRecent); app.get('/recent.rss', middleware.maintenanceMode, generateForRecent);

@ -1,9 +1,6 @@
'use strict'; 'use strict';
var async = require('async');
var winston = require('winston');
var user = require('../user'); var user = require('../user');
var meta = require('../meta'); var meta = require('../meta');

@ -1,8 +1,5 @@
'use strict'; 'use strict';
var async = require('async');
var topics = require('../topics'); var topics = require('../topics');
var websockets = require('./index'); var websockets = require('./index');
var user = require('../user'); var user = require('../user');

@ -2,9 +2,8 @@
'use strict'; 'use strict';
var async = require('async'); var async = require('async');
var winston = require('winston');
var db = require('../database'); var db = require('../database');
var user = require('../user');
var posts = require('../posts'); var posts = require('../posts');
var privileges = require('../privileges'); var privileges = require('../privileges');
var plugins = require('../plugins'); var plugins = require('../plugins');

@ -1,10 +1,6 @@
'use strict'; 'use strict';
var async = require('async');
var db = require('../database'); var db = require('../database');
var posts = require('../posts');
module.exports = function (Topics) { module.exports = function (Topics) {
Topics.isOwner = function (tid, uid, callback) { Topics.isOwner = function (tid, uid, callback) {

@ -1,8 +1,8 @@
'use strict'; 'use strict';
var async = require('async'); var async = require('async');
var db = require('../database'); var db = require('../database');
var plugins = require('../plugins');
module.exports = function (User) { module.exports = function (User) {
User.ban = function (uid, until, reason, callback) { User.ban = function (uid, until, reason, callback) {

@ -134,7 +134,7 @@ module.exports = function (User) {
db.setRemove('invitation:uid:' + invitedByUid, email, next); db.setRemove('invitation:uid:' + invitedByUid, email, next);
}, },
function deleteInviteKey(next) { function deleteInviteKey(next) {
db.delete('invitation:email:' + email, callback); db.delete('invitation:email:' + email, next);
}, },
], function (err) { ], function (err) {
next(err); next(err);

@ -1,5 +1,8 @@
{ {
"env": { "env": {
"mocha": true "mocha": true
},
"rules": {
"no-unused-vars": "off"
} }
} }

@ -31,10 +31,10 @@ describe('rewards', function () {
async.series([ async.series([
function (next) { function (next) {
Groups.join('administrators', adminUid, done); Groups.join('administrators', adminUid, next);
}, },
function (next) { function (next) {
Groups.join('rewardGroup', adminUid, done); Groups.join('rewardGroup', adminUid, next);
}, },
], done); ], done);
}); });

Loading…
Cancel
Save