ESlint no-unused-vars

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

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

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

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

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

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

@ -15,7 +15,7 @@ define('admin/appearance/customise', ['admin/settings'], function (Settings) {
customCSS.setTheme('ace/theme/twilight');
customCSS.getSession().setMode('ace/mode/css');
customCSS.on('change', function (event) {
customCSS.on('change', function () {
app.flags = app.flags || {};
app.flags._unsaved = true;
$('#customCSS-holder').val(customCSS.getValue());
@ -24,7 +24,7 @@ define('admin/appearance/customise', ['admin/settings'], function (Settings) {
customHTML.setTheme('ace/theme/twilight');
customHTML.getSession().setMode('ace/mode/html');
customHTML.on('change', function (event) {
customHTML.on('change', function () {
app.flags = app.flags || {};
app.flags._unsaved = true;
$('#customHTML-holder').val(customHTML.getValue());

@ -71,21 +71,19 @@ define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, t
return;
}
require(['semver'], function (semver) {
if (payload.version !== 'latest') {
Plugins.toggleInstall(pluginID, payload.version);
} else if (payload.version === 'latest') {
confirmInstall(pluginID, function (confirm) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
btn.removeAttr('disabled');
}
});
} else {
btn.removeAttr('disabled');
}
});
if (payload.version !== 'latest') {
Plugins.toggleInstall(pluginID, payload.version);
} else if (payload.version === 'latest') {
confirmInstall(pluginID, function (confirm) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
btn.removeAttr('disabled');
}
});
} else {
btn.removeAttr('disabled');
}
});
});
@ -198,7 +196,6 @@ define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, t
Plugins.toggleInstall = function (pluginID, version, callback) {
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');
socket.emit('admin.plugins.toggleInstall', {

@ -42,7 +42,6 @@ define('admin/extend/rewards', ['translator'], function (translator) {
.on('click', '.toggle', function () {
var btn = $(this);
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') + ']]');
// send disable api call
return false;

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

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

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

@ -1,7 +1,7 @@
'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 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 () {
var $this = $(this);
$this.val($this.attr('data-value'));
@ -226,7 +200,7 @@ define('admin/manage/category', [
ajaxify.data.category.tagWhitelist.forEach(function (tag) {
tagEl.tagsinput('add', tag);
});
tagEl.on('itemAdded itemRemoved', function (event) {
tagEl.on('itemAdded itemRemoved', function () {
modified(tagEl);
});
}

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

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

@ -5,7 +5,7 @@ define('admin/manage/registration', function () {
var Registration = {};
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 action = $(this).attr('data-action');
var username = parent.attr('data-username');
@ -20,7 +20,7 @@ define('admin/manage/registration', function () {
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 email = parent.attr('data-invitation-mail');
var invitedBy = parent.attr('data-invited-by');

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

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

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

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

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

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

@ -112,11 +112,11 @@ define('forum/category', [
});
};
Category.navigatorCallback = function (topIndex, bottomIndex, elementCount) {
Category.navigatorCallback = function (topIndex, 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) {
var bookmarkIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark');
var clickedIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark:clicked');

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

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

@ -1,7 +1,7 @@
'use strict';
define('forum/login', ['translator'], function (translator) {
define('forum/login', [], function () {
var Login = {};
Login.init = function () {
@ -35,10 +35,10 @@ define('forum/login', ['translator'], function (translator) {
headers: {
'x-csrf-token': config.csrf_token,
},
success: function (data, status) {
success: function (data) {
window.location.href = data + '?loggedin';
},
error: function (data, status) {
error: function (data) {
if (data.status === 403 && data.responseText === 'Forbidden') {
window.location.href = config.relative_path + '/login?error=csrf-invalid';
} 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 pid = post.data('pid');
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()) {
parent.addClass('error');
help.html('Passwords do not match.');
@ -116,7 +116,7 @@ $('document').ready(function () {
$.post('/launch', function () {
setInterval(function () {
$.get('/admin').done(function (data) {
$.get('/admin').done(function () {
window.location = 'admin';
});
}, 750);

@ -44,7 +44,7 @@ define('iconSelect', function () {
success: {
label: 'Select',
className: 'btn-primary',
callback: function (confirm) {
callback: function () {
var iconClass = $('.bootbox .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', {
tid: tid,
term: term,

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

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

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

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

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

@ -2,7 +2,7 @@
var cacheController = {};
cacheController.get = function (req, res, next) {
cacheController.get = function (req, res) {
var postCache = require('../../posts/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.
res.render('admin/manage/categories', {});
};

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

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

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

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

@ -18,7 +18,7 @@ helpers.notAllowed = function (req, res, error) {
req: req,
res: res,
error: error,
}, function (err, data) {
}, function (err) {
if (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) {
case 'EBADCSRFTOKEN':
winston.error(req.path + '\n', err.message);

@ -18,7 +18,7 @@ module.exports = function (db, module) {
}
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);
});
} else {
@ -33,7 +33,7 @@ module.exports = function (db, module) {
return callback();
}
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);
});
};
@ -48,7 +48,7 @@ module.exports = function (db, module) {
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);
});
});
@ -61,7 +61,7 @@ module.exports = function (db, module) {
}
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);
});
};
@ -76,7 +76,7 @@ module.exports = function (db, module) {
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);
});
});

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

@ -24,7 +24,7 @@ module.exports = function (db, module) {
}, {
upsert: true,
w: 1,
}, function (err, res) {
}, function (err) {
callback(err);
});
};
@ -54,7 +54,7 @@ module.exports = function (db, module) {
} });
}
bulk.execute(function (err, res) {
bulk.execute(function (err) {
callback(err);
});
};
@ -69,7 +69,7 @@ module.exports = function (db, module) {
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);
});
};
@ -89,7 +89,7 @@ module.exports = function (db, module) {
} });
}
bulk.execute(function (err, res) {
bulk.execute(function (err) {
callback(err);
});
};

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

@ -96,13 +96,13 @@ module.exports = function (redisClient, module) {
module.deleteObjectField = function (key, field, callback) {
callback = callback || function () {};
redisClient.hdel(key, field, function (err, res) {
redisClient.hdel(key, field, function (err) {
callback(err);
});
};
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);
});
};

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

@ -21,7 +21,7 @@ module.exports = function (redisClient, module) {
module.delete = function (key, callback) {
callback = callback || function () {};
redisClient.del(key, function (err, res) {
redisClient.del(key, function (err) {
callback(err);
});
};
@ -32,7 +32,7 @@ module.exports = function (redisClient, module) {
for (var i = 0; i < keys.length; i += 1) {
multi.del(keys[i]);
}
multi.exec(function (err, res) {
multi.exec(function (err) {
callback(err);
});
};
@ -55,7 +55,7 @@ module.exports = function (redisClient, module) {
module.rename = function (oldKey, newKey, callback) {
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);
});
};

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

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

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

@ -10,7 +10,6 @@ var ensureLoggedIn = require('connect-ensure-login');
var toobusy = require('toobusy-js');
var plugins = require('../plugins');
var languages = require('../languages');
var meta = require('../meta');
var user = require('../user');
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 localPath = path.join(__dirname, '../../public/vendor/jquery/timeago/locales', req.path);
var exists;

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

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

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

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

@ -221,13 +221,11 @@ module.exports = function (privileges) {
};
function isPostEditable(pid, uid, callback) {
var tid;
async.waterfall([
function (next) {
posts.getPostFields(pid, ['tid', 'timestamp'], next);
},
function (postData, next) {
tid = postData.tid;
var postEditDuration = parseInt(meta.config.postEditDuration, 10);
if (postEditDuration && Date.now() - parseInt(postData.timestamp, 10) > postEditDuration * 1000) {
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 fs = require('fs');
fs.access('node_modules/' + themeId + '/package.json', function (err, fd) {
fs.access('node_modules/' + themeId + '/package.json', function (err) {
if (err) {
winston.warn('[reset] Theme `%s` is not installed on this forum', themeId);
callback(new Error('theme-not-found'));

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

@ -13,7 +13,7 @@ var meta = require('../meta');
var helpers = require('../controllers/helpers');
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('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory);
app.get('/recent.rss', middleware.maintenanceMode, generateForRecent);

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

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

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

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

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

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

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

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

Loading…
Cancel
Save