more linting

v1.18.x
Julian Lam 8 years ago
parent ddea9f534e
commit 6e7b505ea7

@ -16,7 +16,9 @@ define('forum/flags/list', ['components', 'Chart'], function (components, Chart)
// Parse ajaxify data to set form values to reflect current filters
for (var filter in ajaxify.data.filters) {
filtersEl.find('[name="' + filter + '"]').val(ajaxify.data.filters[filter]);
if (ajaxify.data.filters.hasOwnProperty(filter)) {
filtersEl.find('[name="' + filter + '"]').val(ajaxify.data.filters[filter]);
}
}
filtersEl.find('button').on('click', function () {

@ -42,16 +42,14 @@ modsController.flags.list = function (req, res, next) {
if (!filters.cid) {
// If mod and no cid filter, add filter for their modded categories
filters.cid = res.locals.cids;
} else {
} else if (Array.isArray(filters.cid)) {
// Remove cids they do not moderate
if (Array.isArray(filters.cid)) {
filters.cid = filters.cid.filter(function (cid) {
return res.locals.cids.indexOf(String(cid)) !== -1;
});
} else if (res.locals.cids.indexOf(String(filters.cid)) === -1) {
filters.cid = res.locals.cids;
hasFilter = false;
}
filters.cid = filters.cid.filter(function (cid) {
return res.locals.cids.indexOf(String(cid)) !== -1;
});
} else if (res.locals.cids.indexOf(String(filters.cid)) === -1) {
filters.cid = res.locals.cids;
hasFilter = false;
}
}

@ -92,7 +92,7 @@ file.allowedExtensions = function () {
};
file.exists = function (path, callback) {
fs.stat(path, function (err, stat) {
fs.stat(path, function (err) {
if (err) {
if (err.code === 'ENOENT') {
return callback(null, false);

@ -1,7 +1,6 @@
'use strict';
var async = require('async');
var winston = require('winston');
var db = require('./database');
var user = require('./user');
var groups = require('./groups');
@ -69,38 +68,40 @@ Flags.list = function (filters, uid, callback) {
if (Object.keys(filters).length > 0) {
for (var type in filters) {
switch (type) {
case 'type':
prepareSets('flags:byType:', filters[type]);
break;
case 'state':
prepareSets('flags:byState:', filters[type]);
break;
case 'reporterId':
prepareSets('flags:byReporter:', filters[type]);
break;
case 'assignee':
prepareSets('flags:byAssignee:', filters[type]);
break;
case 'targetUid':
prepareSets('flags:byTargetUid:', filters[type]);
break;
case 'cid':
prepareSets('flags:byCid:', filters[type]);
break;
case 'quick':
switch (filters.quick) {
case 'mine':
sets.push('flags:byAssignee:' + uid);
if (filters.hasOwnProperty(type)) {
switch (type) {
case 'type':
prepareSets('flags:byType:', filters[type]);
break;
case 'state':
prepareSets('flags:byState:', filters[type]);
break;
case 'reporterId':
prepareSets('flags:byReporter:', filters[type]);
break;
case 'assignee':
prepareSets('flags:byAssignee:', filters[type]);
break;
case 'targetUid':
prepareSets('flags:byTargetUid:', filters[type]);
break;
case 'cid':
prepareSets('flags:byCid:', filters[type]);
break;
case 'quick':
switch (filters.quick) {
case 'mine':
sets.push('flags:byAssignee:' + uid);
break;
}
break;
}
break;
}
}
}
@ -341,7 +342,7 @@ Flags.create = function (type, id, uid, reason, timestamp, callback) {
tasks.push(async.apply(db.sortedSetAdd.bind(db), 'flags:byPid:' + id, timestamp, flagId)); // by target pid
}
async.parallel(tasks, function (err, data) {
async.parallel(tasks, function (err) {
if (err) {
return next(err);
}
@ -479,7 +480,7 @@ Flags.update = function (flagId, uid, changeset, callback) {
// Fire plugin hook
tasks.push(async.apply(plugins.fireHook, 'action:flag.update', { flagId: flagId, changeset: changeset, uid: uid }));
async.parallel(tasks, function (err, data) {
async.parallel(tasks, function (err) {
return next(err);
});
},

@ -8,7 +8,6 @@ var topics = require('../topics');
var user = require('../user');
var notifications = require('../notifications');
var plugins = require('../plugins');
var flags = require('../flags');
module.exports = function (Posts) {
Posts.delete = function (pid, uid, callback) {

@ -1,17 +1,8 @@
'use strict';
var async = require('async');
var S = require('string');
var user = require('../user');
var groups = require('../groups');
var posts = require('../posts');
var topics = require('../topics');
var privileges = require('../privileges');
var notifications = require('../notifications');
var plugins = require('../plugins');
var meta = require('../meta');
var utils = require('../../public/src/utils');
var flags = require('../flags');
var SocketFlags = {};

@ -323,7 +323,6 @@ Upgrade.upgrade = function (callback) {
var batch = require('./batch');
var posts = require('./posts');
var flags = require('./flags');
var migrated = 0;
batch.processSortedSet('posts:pid', function (ids, next) {
posts.getPostsByPids(ids, 1, function (err, posts) {

@ -3,10 +3,8 @@
var async = require('async');
var db = require('../database');
var posts = require('../posts');
var plugins = require('../plugins');
var winston = require('winston');
var flags = require('../flags');
module.exports = function (User) {
User.logIP = function (uid, ip) {

@ -487,9 +487,9 @@ describe('Flags', function () {
describe('(websockets)', function () {
var SocketFlags = require('../src/socket.io/flags.js');
var tid,
pid,
flag;
var tid;
var pid;
var flag;
before(function (done) {
Topics.post({

Loading…
Cancel
Save