more linting

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

@ -16,8 +16,10 @@ 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) {
if (ajaxify.data.filters.hasOwnProperty(filter)) {
filtersEl.find('[name="' + filter + '"]').val(ajaxify.data.filters[filter]);
}
}
filtersEl.find('button').on('click', function () {
var payload = filtersEl.serializeArray().filter(function (item) {

@ -42,9 +42,8 @@ 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;
});
@ -53,7 +52,6 @@ modsController.flags.list = function (req, res, next) {
hasFilter = false;
}
}
}
async.parallel({
flags: async.apply(flags.list, filters, req.uid),

@ -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,6 +68,7 @@ Flags.list = function (filters, uid, callback) {
if (Object.keys(filters).length > 0) {
for (var type in filters) {
if (filters.hasOwnProperty(type)) {
switch (type) {
case 'type':
prepareSets('flags:byType:', filters[type]);
@ -104,6 +104,7 @@ Flags.list = function (filters, uid, callback) {
}
}
}
}
sets = (sets.length || orSets.length) ? sets : ['flags:datetime']; // No filter default
async.waterfall([
@ -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