mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 07:33:15 +02:00
ESlint comma-dangle
This commit is contained in:
@@ -10,7 +10,7 @@ var accountsController = {
|
||||
posts: require('./accounts/posts'),
|
||||
notifications: require('./accounts/notifications'),
|
||||
chats: require('./accounts/chats'),
|
||||
session: require('./accounts/session')
|
||||
session: require('./accounts/session'),
|
||||
};
|
||||
|
||||
module.exports = accountsController;
|
||||
|
||||
@@ -21,7 +21,7 @@ chatsController.get = function (req, res, callback) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
uid: async.apply(user.getUidByUserslug, req.params.userslug),
|
||||
username: async.apply(user.getUsernameByUserslug, req.params.userslug)
|
||||
username: async.apply(user.getUsernameByUserslug, req.params.userslug),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -45,7 +45,7 @@ chatsController.get = function (req, res, callback) {
|
||||
nextStart: recentChats.nextStart,
|
||||
allowed: true,
|
||||
title: '[[pages:chats]]',
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: username, url: '/user/' + req.params.userslug}, {text: '[[pages:chats]]'}])
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: username, url: '/user/' + req.params.userslug}, {text: '[[pages:chats]]'}]),
|
||||
});
|
||||
}
|
||||
messaging.isUserInRoom(req.uid, req.params.roomid, next);
|
||||
@@ -62,10 +62,10 @@ chatsController.get = function (req, res, callback) {
|
||||
callerUid: req.uid,
|
||||
uid: uid,
|
||||
roomId: req.params.roomid,
|
||||
isNew: false
|
||||
})
|
||||
isNew: false,
|
||||
}),
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -89,7 +89,7 @@ chatsController.get = function (req, res, callback) {
|
||||
room.breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{text: username, url: '/user/' + req.params.userslug},
|
||||
{text: '[[pages:chats]]', url: '/user/' + req.params.userslug + '/chats'},
|
||||
{text: room.roomName || room.usernames || '[[pages:chats]]'}
|
||||
{text: room.roomName || room.usernames || '[[pages:chats]]'},
|
||||
]);
|
||||
room.maximumUsersInChatRoom = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0;
|
||||
room.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000;
|
||||
|
||||
@@ -78,7 +78,7 @@ function renderRoute(name, req, res, next) {
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{text: userData.username, url: '/user/' + userData.userslug},
|
||||
{text: '[[user:edit]]', url: '/user/' + userData.userslug + '/edit'},
|
||||
{text: '[[user:' + name + ']]'}
|
||||
{text: '[[user:' + name + ']]'},
|
||||
]);
|
||||
|
||||
res.render('account/edit/' + name, userData);
|
||||
@@ -97,7 +97,7 @@ function getUserData(req, next, callback) {
|
||||
return callback();
|
||||
}
|
||||
db.getObjectField('user:' + userData.uid, 'password', next);
|
||||
}
|
||||
},
|
||||
], function (err, password) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -128,7 +128,7 @@ editController.uploadPicture = function (req, res, next) {
|
||||
}
|
||||
|
||||
user.uploadPicture(updateUid, userPhoto, next);
|
||||
}
|
||||
},
|
||||
], function (err, image) {
|
||||
fs.unlink(userPhoto.path, function (err) {
|
||||
if (err) {
|
||||
@@ -148,7 +148,7 @@ editController.uploadCoverPicture = function (req, res, next) {
|
||||
|
||||
user.updateCoverPicture({
|
||||
file: req.files.files[0],
|
||||
uid: params.uid
|
||||
uid: params.uid,
|
||||
}, function (err, image) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -36,7 +36,7 @@ function getFollow(tpl, name, req, res, callback) {
|
||||
}
|
||||
var method = name === 'following' ? 'getFollowing' : 'getFollowers';
|
||||
user[method](userData.uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
], function (err, users) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -38,7 +38,7 @@ groupsController.get = function (req, res, callback) {
|
||||
group.members = members[index];
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -59,7 +59,7 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
|
||||
},
|
||||
sso: function (next) {
|
||||
plugins.fireHook('filter:auth.list', {uid: uid, associations: []}, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -144,7 +144,7 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
|
||||
userData['email:disableEdit'] = !userData.isAdmin && parseInt(meta.config['email:disableEdit'], 10) === 1;
|
||||
|
||||
next(null, userData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ infoController.get = function (req, res, callback) {
|
||||
history: async.apply(user.getModerationHistory, userData.uid),
|
||||
sessions: async.apply(user.auth.getSessions, userData.uid, req.sessionID),
|
||||
usernames: async.apply(user.getHistory, 'user:' + userData.uid + ':usernames'),
|
||||
emails: async.apply(user.getHistory, 'user:' + userData.uid + ':emails')
|
||||
emails: async.apply(user.getHistory, 'user:' + userData.uid + ':emails'),
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -14,7 +14,7 @@ notificationsController.get = function (req, res, next) {
|
||||
notifications: notifications,
|
||||
nextStart: 40,
|
||||
title: '[[pages:notifications]]',
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[pages:notifications]]'}])
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[pages:notifications]]'}]),
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -18,44 +18,44 @@ var templateToData = {
|
||||
set: 'bookmarks',
|
||||
type: 'posts',
|
||||
noItemsFoundKey: '[[topic:bookmarks.has_no_bookmarks]]',
|
||||
crumb: '[[user:bookmarks]]'
|
||||
crumb: '[[user:bookmarks]]',
|
||||
},
|
||||
'account/posts': {
|
||||
set: 'posts',
|
||||
type: 'posts',
|
||||
noItemsFoundKey: '[[user:has_no_posts]]',
|
||||
crumb: '[[global:posts]]'
|
||||
crumb: '[[global:posts]]',
|
||||
},
|
||||
'account/upvoted': {
|
||||
set: 'upvote',
|
||||
type: 'posts',
|
||||
noItemsFoundKey: '[[user:has_no_upvoted_posts]]',
|
||||
crumb: '[[global:upvoted]]'
|
||||
crumb: '[[global:upvoted]]',
|
||||
},
|
||||
'account/downvoted': {
|
||||
set: 'downvote',
|
||||
type: 'posts',
|
||||
noItemsFoundKey: '[[user:has_no_downvoted_posts]]',
|
||||
crumb: '[[global:downvoted]]'
|
||||
crumb: '[[global:downvoted]]',
|
||||
},
|
||||
'account/best': {
|
||||
set: 'posts:votes',
|
||||
type: 'posts',
|
||||
noItemsFoundKey: '[[user:has_no_voted_posts]]',
|
||||
crumb: '[[global:best]]'
|
||||
crumb: '[[global:best]]',
|
||||
},
|
||||
'account/watched': {
|
||||
set: 'followed_tids',
|
||||
type: 'topics',
|
||||
noItemsFoundKey: '[[user:has_no_watched_topics]]',
|
||||
crumb: '[[user:watched]]'
|
||||
crumb: '[[user:watched]]',
|
||||
},
|
||||
'account/topics': {
|
||||
set: 'topics',
|
||||
type: 'topics',
|
||||
noItemsFoundKey: '[[user:has_no_topics]]',
|
||||
crumb: '[[global:topics]]'
|
||||
}
|
||||
crumb: '[[global:topics]]',
|
||||
},
|
||||
};
|
||||
|
||||
postsController.getBookmarks = function (req, res, next) {
|
||||
@@ -101,7 +101,7 @@ function getFromUserSet(template, req, res, callback) {
|
||||
},
|
||||
userData: function (next) {
|
||||
accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -127,9 +127,9 @@ function getFromUserSet(template, req, res, callback) {
|
||||
var start = (page - 1) * itemsPerPage;
|
||||
var stop = start + itemsPerPage - 1;
|
||||
data.method(setName, req.uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -62,7 +62,7 @@ profileController.get = function (req, res, callback) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -93,20 +93,20 @@ profileController.get = function (req, res, callback) {
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: "title",
|
||||
content: userData.fullname || userData.username
|
||||
content: userData.fullname || userData.username,
|
||||
},
|
||||
{
|
||||
name: "description",
|
||||
content: plainAboutMe
|
||||
content: plainAboutMe,
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: userData.fullname || userData.username
|
||||
content: userData.fullname || userData.username,
|
||||
},
|
||||
{
|
||||
property: 'og:description',
|
||||
content: plainAboutMe
|
||||
}
|
||||
content: plainAboutMe,
|
||||
},
|
||||
];
|
||||
|
||||
if (userData.picture) {
|
||||
@@ -114,13 +114,13 @@ profileController.get = function (req, res, callback) {
|
||||
{
|
||||
property: 'og:image',
|
||||
content: userData.picture,
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
},
|
||||
{
|
||||
property: "og:image:url",
|
||||
content: userData.picture,
|
||||
noEscape: true
|
||||
}
|
||||
noEscape: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
userData.selectedGroup = userData.groups.find(function (group) {
|
||||
@@ -128,7 +128,7 @@ profileController.get = function (req, res, callback) {
|
||||
});
|
||||
|
||||
plugins.fireHook('filter:user.account', {userData: userData, uid: req.uid}, next);
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -42,7 +42,7 @@ sessionController.revoke = function (req, res, next) {
|
||||
}
|
||||
|
||||
user.auth.revokeSession(_id, uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return res.status(500).send(err.message);
|
||||
|
||||
@@ -42,7 +42,7 @@ settingsController.get = function (req, res, callback) {
|
||||
},
|
||||
soundsMapping: function (next) {
|
||||
meta.sounds.getMapping(userData.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -53,7 +53,7 @@ settingsController.get = function (req, res, callback) {
|
||||
var soundSettings = {
|
||||
'notificationSound': 'notification',
|
||||
'incomingChatSound': 'chat-incoming',
|
||||
'outgoingChatSound': 'chat-outgoing'
|
||||
'outgoingChatSound': 'chat-outgoing',
|
||||
};
|
||||
|
||||
Object.keys(soundSettings).forEach(function (setting) {
|
||||
@@ -68,7 +68,7 @@ settingsController.get = function (req, res, callback) {
|
||||
userData.customSettings = data.customSettings;
|
||||
userData.disableEmailSubscriptions = parseInt(meta.config.disableEmailSubscriptions, 10) === 1;
|
||||
next();
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -78,7 +78,7 @@ settingsController.get = function (req, res, callback) {
|
||||
{value: 'off', name: '[[user:digest_off]]', selected: 'off' === userData.settings.dailyDigestFreq},
|
||||
{value: 'day', name: '[[user:digest_daily]]', selected: 'day' === userData.settings.dailyDigestFreq},
|
||||
{value: 'week', name: '[[user:digest_weekly]]', selected: 'week' === userData.settings.dailyDigestFreq},
|
||||
{value: 'month', name: '[[user:digest_monthly]]', selected: 'month' === userData.settings.dailyDigestFreq}
|
||||
{value: 'month', name: '[[user:digest_monthly]]', selected: 'month' === userData.settings.dailyDigestFreq},
|
||||
];
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ settingsController.get = function (req, res, callback) {
|
||||
{ "name": "Spacelab", "value": "spacelab" },
|
||||
{ "name": "Superhero", "value": "superhero" },
|
||||
{ "name": "United", "value": "united" },
|
||||
{ "name": "Yeti", "value": "yeti" }
|
||||
{ "name": "Yeti", "value": "yeti" },
|
||||
];
|
||||
|
||||
var isCustom = true;
|
||||
@@ -117,7 +117,7 @@ settingsController.get = function (req, res, callback) {
|
||||
userData.homePageRoutes.push({
|
||||
route: 'custom',
|
||||
name: 'Custom',
|
||||
selected: isCustom
|
||||
selected: isCustom,
|
||||
});
|
||||
|
||||
userData.bootswatchSkinOptions.forEach(function (skin) {
|
||||
@@ -157,7 +157,7 @@ function getHomePageRoutes(callback) {
|
||||
categoryData = categoryData.map(function (category) {
|
||||
return {
|
||||
route: 'category/' + category.slug,
|
||||
name: 'Category: ' + category.name
|
||||
name: 'Category: ' + category.name,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -166,25 +166,25 @@ function getHomePageRoutes(callback) {
|
||||
plugins.fireHook('filter:homepage.get', {routes: [
|
||||
{
|
||||
route: 'categories',
|
||||
name: 'Categories'
|
||||
name: 'Categories',
|
||||
},
|
||||
{
|
||||
route: 'unread',
|
||||
name: 'Unread'
|
||||
name: 'Unread',
|
||||
},
|
||||
{
|
||||
route: 'recent',
|
||||
name: 'Recent'
|
||||
name: 'Recent',
|
||||
},
|
||||
{
|
||||
route: 'popular',
|
||||
name: 'Popular'
|
||||
}
|
||||
name: 'Popular',
|
||||
},
|
||||
].concat(categoryData)}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
next(null, data.routes);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ var adminController = {
|
||||
appearance: require('./admin/appearance'),
|
||||
extend: {
|
||||
widgets: require('./admin/widgets'),
|
||||
rewards: require('./admin/rewards')
|
||||
rewards: require('./admin/rewards'),
|
||||
},
|
||||
events: require('./admin/events'),
|
||||
logs: require('./admin/logs'),
|
||||
@@ -28,7 +28,7 @@ var adminController = {
|
||||
themes: require('./admin/themes'),
|
||||
users: require('./admin/users'),
|
||||
uploads: require('./admin/uploads'),
|
||||
info: require('./admin/info')
|
||||
info: require('./admin/info'),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ blacklistController.get = function (req, res, next) {
|
||||
}
|
||||
res.render('admin/manage/ip-blacklist', {
|
||||
rules: rules,
|
||||
title: '[[pages:ip-blacklist]]'
|
||||
title: '[[pages:ip-blacklist]]',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,15 +19,15 @@ cacheController.get = function (req, res, next) {
|
||||
max: postCache.max,
|
||||
itemCount: postCache.itemCount,
|
||||
percentFull: percentFull,
|
||||
avgPostSize: avgPostSize
|
||||
avgPostSize: avgPostSize,
|
||||
},
|
||||
groupCache: {
|
||||
length: groupCache.length,
|
||||
max: groupCache.max,
|
||||
itemCount: groupCache.itemCount,
|
||||
percentFull: ((groupCache.length / groupCache.max) * 100).toFixed(2),
|
||||
dump: req.query.debug ? JSON.stringify(groupCache.dump(), null, 4) : false
|
||||
}
|
||||
dump: req.query.debug ? JSON.stringify(groupCache.dump(), null, 4) : false,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ var categoriesController = {};
|
||||
categoriesController.get = function (req, res, next) {
|
||||
async.parallel({
|
||||
category: async.apply(categories.getCategories, [req.params.category_id], req.user.uid),
|
||||
privileges: async.apply(privileges.categories.list, req.params.category_id)
|
||||
privileges: async.apply(privileges.categories.list, req.params.category_id),
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -32,7 +32,7 @@ categoriesController.get = function (req, res, next) {
|
||||
data.category.name = translator.escape(String(data.category.name));
|
||||
res.render('admin/manage/category', {
|
||||
category: data.category,
|
||||
privileges: data.privileges
|
||||
privileges: data.privileges,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -46,7 +46,7 @@ categoriesController.getAll = function (req, res, next) {
|
||||
categoriesController.getAnalytics = function (req, res, next) {
|
||||
async.parallel({
|
||||
name: async.apply(categories.getCategoryField, req.params.category_id, 'name'),
|
||||
analytics: async.apply(analytics.getCategoryAnalytics, req.params.category_id)
|
||||
analytics: async.apply(analytics.getCategoryAnalytics, req.params.category_id),
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -20,18 +20,18 @@ dashboardController.get = function (req, res, next) {
|
||||
{
|
||||
done: !meta.reloadRequired,
|
||||
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'),
|
||||
doneText: '[[admin/general/dashboard:search-plugin-installed]]',
|
||||
notDoneText:'[[admin/general/dashboard:search-plugin-not-installed]]',
|
||||
tooltip: '[[admin/general/dashboard:search-plugin-tooltip]]',
|
||||
link:'/admin/extend/plugins'
|
||||
}
|
||||
link:'/admin/extend/plugins',
|
||||
},
|
||||
];
|
||||
plugins.fireHook('filter:admin.notices', notices, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -39,7 +39,7 @@ dashboardController.get = function (req, res, next) {
|
||||
res.render('admin/general/dashboard', {
|
||||
version: nconf.get('version'),
|
||||
notices: results.notices,
|
||||
stats: results.stats
|
||||
stats: results.stats,
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -57,7 +57,7 @@ function getStats(callback) {
|
||||
},
|
||||
function (next) {
|
||||
getStatsForSet('topics:tid', 'topicCount', next);
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -75,7 +75,7 @@ function getStatsForSet(set, field, callback) {
|
||||
var terms = {
|
||||
day: 86400000,
|
||||
week: 604800000,
|
||||
month: 2592000000
|
||||
month: 2592000000,
|
||||
};
|
||||
|
||||
var now = Date.now();
|
||||
@@ -91,7 +91,7 @@ function getStatsForSet(set, field, callback) {
|
||||
},
|
||||
alltime: function (next) {
|
||||
getGlobalField(field, next);
|
||||
}
|
||||
},
|
||||
}, callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ databaseController.get = function (req, res, next) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -11,7 +11,7 @@ var errorsController = {};
|
||||
errorsController.get = function (req, res, next) {
|
||||
async.parallel({
|
||||
'not-found': async.apply(meta.errors.get, true),
|
||||
analytics: async.apply(analytics.getErrorAnalytics)
|
||||
analytics: async.apply(analytics.getErrorAnalytics),
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -24,7 +24,7 @@ errorsController.get = function (req, res, next) {
|
||||
errorsController.export = function (req, res, next) {
|
||||
async.waterfall([
|
||||
async.apply(meta.errors.get, false),
|
||||
async.apply(json2csv)
|
||||
async.apply(json2csv),
|
||||
], function (err, csv) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -22,7 +22,7 @@ eventsController.get = function (req, res, next) {
|
||||
},
|
||||
events: function (next) {
|
||||
events.getEvents(start, stop, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -33,7 +33,7 @@ eventsController.get = function (req, res, next) {
|
||||
res.render('admin/advanced/events', {
|
||||
events: results.events,
|
||||
pagination: pagination.create(page, pageCount),
|
||||
next: 20
|
||||
next: 20,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ flagsController.get = function (req, res, next) {
|
||||
analytics: function (next) {
|
||||
analytics.getDailyStatsForSet('analytics:flags', Date.now(), 30, next);
|
||||
},
|
||||
assignees: async.apply(user.getAdminsandGlobalModsandModerators)
|
||||
assignees: async.apply(user.getAdminsandGlobalModsandModerators),
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -39,7 +39,7 @@ flagsController.get = function (req, res, next) {
|
||||
results.assignees = results.assignees.map(function (userObj) {
|
||||
return {
|
||||
uid: userObj.uid,
|
||||
username: userObj.username
|
||||
username: userObj.username,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ function getFlagData(req, res, callback) {
|
||||
}
|
||||
|
||||
posts.getFlags(sets, cid, req.uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ groupsController.list = function (req, res, next) {
|
||||
},
|
||||
function (groupData, next) {
|
||||
next(null, {groups: groupData, pagination: pagination.create(page, pageCount)});
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -44,7 +44,7 @@ groupsController.list = function (req, res, next) {
|
||||
res.render('admin/manage/groups', {
|
||||
groups: data.groups,
|
||||
pagination: data.pagination,
|
||||
yourid: req.uid
|
||||
yourid: req.uid,
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -60,7 +60,7 @@ groupsController.get = function (req, res, callback) {
|
||||
return callback();
|
||||
}
|
||||
groups.get(groupName, {uid: req.uid, truncateUserList: true, userListCount: 20}, next);
|
||||
}
|
||||
},
|
||||
], function (err, group) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -25,11 +25,11 @@ homePageController.get = function (req, res, next) {
|
||||
categoryData = categoryData.map(function (category) {
|
||||
return {
|
||||
route: 'category/' + category.slug,
|
||||
name: 'Category: ' + category.name
|
||||
name: 'Category: ' + category.name,
|
||||
};
|
||||
});
|
||||
next(null, categoryData);
|
||||
}
|
||||
},
|
||||
], function (err, categoryData) {
|
||||
if (err || !categoryData) {
|
||||
categoryData = [];
|
||||
@@ -38,16 +38,16 @@ homePageController.get = function (req, res, next) {
|
||||
plugins.fireHook('filter:homepage.get', {routes: [
|
||||
{
|
||||
route: 'categories',
|
||||
name: 'Categories'
|
||||
name: 'Categories',
|
||||
},
|
||||
{
|
||||
route: 'recent',
|
||||
name: 'Recent'
|
||||
name: 'Recent',
|
||||
},
|
||||
{
|
||||
route: 'popular',
|
||||
name: 'Popular'
|
||||
}
|
||||
name: 'Popular',
|
||||
},
|
||||
].concat(categoryData)}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -55,7 +55,7 @@ homePageController.get = function (req, res, next) {
|
||||
|
||||
data.routes.push({
|
||||
route: '',
|
||||
name: 'Custom'
|
||||
name: 'Custom',
|
||||
});
|
||||
|
||||
res.render('admin/general/homepage', data);
|
||||
|
||||
@@ -49,7 +49,7 @@ function getNodeInfo(callback) {
|
||||
title: process.title,
|
||||
version: process.version,
|
||||
memoryUsage: process.memoryUsage(),
|
||||
uptime: process.uptime()
|
||||
uptime: process.uptime(),
|
||||
},
|
||||
os: {
|
||||
hostname: os.hostname(),
|
||||
@@ -57,8 +57,8 @@ function getNodeInfo(callback) {
|
||||
platform: os.platform(),
|
||||
arch: os.arch(),
|
||||
release: os.release(),
|
||||
load: os.loadavg().map(function (load) { return load.toFixed(2); }).join(', ')
|
||||
}
|
||||
load: os.loadavg().map(function (load) { return load.toFixed(2); }).join(', '),
|
||||
},
|
||||
};
|
||||
|
||||
async.parallel({
|
||||
@@ -67,7 +67,7 @@ function getNodeInfo(callback) {
|
||||
},
|
||||
gitInfo: function (next) {
|
||||
getGitInfo(next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -93,7 +93,7 @@ function getGitInfo(callback) {
|
||||
},
|
||||
branch: function (next) {
|
||||
get('git rev-parse --abbrev-ref HEAD', next);
|
||||
}
|
||||
},
|
||||
}, callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ languagesController.get = function (req, res, next) {
|
||||
});
|
||||
|
||||
res.render('admin/general/languages', {
|
||||
languages: languages
|
||||
languages: languages,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ logsController.get = function (req, res, next) {
|
||||
}
|
||||
|
||||
res.render('admin/advanced/logs', {
|
||||
data: validator.escape(logs)
|
||||
data: validator.escape(logs),
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ pluginsController.get = function (req, res, next) {
|
||||
|
||||
next(null, plugins);
|
||||
});
|
||||
}
|
||||
},
|
||||
}, function (err, payload) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -48,7 +48,7 @@ pluginsController.get = function (req, res, next) {
|
||||
}),
|
||||
incompatible: payload.all.filter(function (plugin) {
|
||||
return compatiblePkgNames.indexOf(plugin.name) === -1;
|
||||
})
|
||||
}),
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,11 +47,11 @@ function renderEmail(req, res, next) {
|
||||
path: path,
|
||||
fullpath: email,
|
||||
text: text,
|
||||
original: original.toString()
|
||||
original: original.toString(),
|
||||
});
|
||||
});
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, emails) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -61,7 +61,7 @@ function renderEmail(req, res, next) {
|
||||
emails: emails,
|
||||
sendable: emails.filter(function (email) {
|
||||
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
||||
})
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ socialController.get = function (req, res, next) {
|
||||
}
|
||||
|
||||
res.render('admin/general/social', {
|
||||
posts: posts
|
||||
posts: posts,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -12,12 +12,12 @@ soundsController.get = function (req, res, next) {
|
||||
|
||||
sounds = Object.keys(sounds).map(function (name) {
|
||||
return {
|
||||
name: name
|
||||
name: name,
|
||||
};
|
||||
});
|
||||
|
||||
res.render('admin/general/sounds', {
|
||||
sounds: sounds
|
||||
sounds: sounds,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -73,8 +73,8 @@ uploadsController.uploadTouchIcon = function (req, res, next) {
|
||||
path: path.join(nconf.get('upload_path'), 'system', 'touchicon-' + size + '.png'),
|
||||
extension: 'png',
|
||||
width: size,
|
||||
height: size
|
||||
})
|
||||
height: size,
|
||||
}),
|
||||
], next);
|
||||
}, function (err) {
|
||||
fs.unlink(uploadedFile.path, function (err) {
|
||||
|
||||
@@ -18,7 +18,7 @@ var userFields = ['uid', 'username', 'userslug', 'email', 'postcount', 'joindate
|
||||
usersController.search = function (req, res, next) {
|
||||
res.render('admin/manage/users', {
|
||||
search_display: '',
|
||||
users: []
|
||||
users: [],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -97,14 +97,14 @@ usersController.registrationQueue = function (req, res, next) {
|
||||
invites.invitations = invites.invitations.map(function (email, i) {
|
||||
return {
|
||||
email: email,
|
||||
username: usernames[index][i] === '[[global:guest]]' ? '' : usernames[index][i]
|
||||
username: usernames[index][i] === '[[global:guest]]' ? '' : usernames[index][i],
|
||||
};
|
||||
});
|
||||
});
|
||||
next(null, invitations);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -142,9 +142,9 @@ function getUsers(set, section, min, max, req, res, next) {
|
||||
},
|
||||
function (uids, next) {
|
||||
user.getUsersWithFields(uids, userFields, req.uid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -157,7 +157,7 @@ function getUsers(set, section, min, max, req, res, next) {
|
||||
var data = {
|
||||
users: results.users,
|
||||
page: page,
|
||||
pageCount: Math.max(1, Math.ceil(results.count / resultsPerPage))
|
||||
pageCount: Math.max(1, Math.ceil(results.count / resultsPerPage)),
|
||||
};
|
||||
data[section] = true;
|
||||
render(req, res, data);
|
||||
@@ -181,7 +181,7 @@ usersController.getCSV = function (req, res, next) {
|
||||
events.log({
|
||||
type: 'getUsersCSV',
|
||||
uid: req.user.uid,
|
||||
ip: req.ip
|
||||
ip: req.ip,
|
||||
});
|
||||
|
||||
user.getUsersCSV(function (err, data) {
|
||||
|
||||
@@ -71,7 +71,7 @@ apiController.getConfig = function (req, res, next) {
|
||||
enabled: parseInt(meta.config.cookieConsentEnabled, 10) === 1,
|
||||
message: translator.escape(meta.config.cookieConsentMessage || '[[global:cookies.message]]').replace(/\\/g, '\\\\'),
|
||||
dismiss: translator.escape(meta.config.cookieConsentDismiss || '[[global:cookies.accept]]').replace(/\\/g, '\\\\'),
|
||||
link: translator.escape(meta.config.cookieConsentLink || '[[global:cookies.learn_more]]').replace(/\\/g, '\\\\')
|
||||
link: translator.escape(meta.config.cookieConsentLink || '[[global:cookies.learn_more]]').replace(/\\/g, '\\\\'),
|
||||
};
|
||||
|
||||
async.waterfall([
|
||||
@@ -93,7 +93,7 @@ apiController.getConfig = function (req, res, next) {
|
||||
config.delayImageLoading = settings.delayImageLoading !== undefined ? settings.delayImageLoading : true;
|
||||
config.bootswatchSkin = settings.bootswatchSkin || config.bootswatchSkin;
|
||||
plugins.fireHook('filter:config.get', config, next);
|
||||
}
|
||||
},
|
||||
], function (err, config) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -119,7 +119,7 @@ apiController.renderWidgets = function (req, res, next) {
|
||||
url: req.query.url,
|
||||
locations: req.query.locations,
|
||||
isMobile: req.query.isMobile === 'true',
|
||||
cid: req.query.cid
|
||||
cid: req.query.cid,
|
||||
},
|
||||
req,
|
||||
res,
|
||||
@@ -138,7 +138,7 @@ apiController.getPostData = function (pid, uid, callback) {
|
||||
},
|
||||
post: function (next) {
|
||||
posts.getPostData(pid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err || !results.post) {
|
||||
return callback(err);
|
||||
@@ -167,7 +167,7 @@ apiController.getTopicData = function (tid, uid, callback) {
|
||||
},
|
||||
topic: function (next) {
|
||||
topics.getTopicData(tid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err || !results.topic) {
|
||||
return callback(err);
|
||||
@@ -187,7 +187,7 @@ apiController.getCategoryData = function (cid, uid, callback) {
|
||||
},
|
||||
category: function (next) {
|
||||
categories.getCategoryData(cid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err || !results.category) {
|
||||
return callback(err);
|
||||
@@ -205,7 +205,7 @@ apiController.getObject = function (req, res, next) {
|
||||
var methods = {
|
||||
post: apiController.getPostData,
|
||||
topic: apiController.getTopicData,
|
||||
category: apiController.getCategoryData
|
||||
category: apiController.getCategoryData,
|
||||
};
|
||||
var method = methods[req.params.type];
|
||||
if (!method) {
|
||||
@@ -230,7 +230,7 @@ apiController.getCurrentUser = function (req, res, next) {
|
||||
},
|
||||
function (userslug, next) {
|
||||
accountHelpers.getUserDataByUserSlug(userslug, req.uid, next);
|
||||
}
|
||||
},
|
||||
], function (err, userData) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -278,7 +278,7 @@ apiController.getUserDataByField = function (callerUid, field, fieldValue, callb
|
||||
return next();
|
||||
}
|
||||
apiController.getUserDataByUID(callerUid, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -293,7 +293,7 @@ apiController.getUserDataByUID = function (callerUid, uid, callback) {
|
||||
|
||||
async.parallel({
|
||||
userData: async.apply(user.getUserData, uid),
|
||||
settings: async.apply(user.getSettings, uid)
|
||||
settings: async.apply(user.getSettings, uid),
|
||||
}, function (err, results) {
|
||||
if (err || !results.userData) {
|
||||
return callback(err || new Error('[[error:no-user]]'));
|
||||
|
||||
@@ -82,7 +82,7 @@ authenticationController.register = function (req, res, next) {
|
||||
} else {
|
||||
registerAndLoginUser(req, res, userData, next);
|
||||
}
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return res.status(400).send(err.message);
|
||||
@@ -102,7 +102,7 @@ function registerAndLoginUser(req, res, userData, callback) {
|
||||
function (next) {
|
||||
plugins.fireHook('filter:register.interstitial', {
|
||||
userData: userData,
|
||||
interstitials: []
|
||||
interstitials: [],
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -134,7 +134,7 @@ function registerAndLoginUser(req, res, userData, callback) {
|
||||
function (next) {
|
||||
user.deleteInvitationKey(userData.email);
|
||||
plugins.fireHook('filter:register.complete', {uid: uid, referrer: req.body.referrer || nconf.get('relative_path') + '/'}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ function addToApprovalQueue(req, userData, callback) {
|
||||
},
|
||||
function (next) {
|
||||
next(null, {message: '[[register:registration-added-to-queue]]'});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ authenticationController.registerComplete = function (req, res, next) {
|
||||
// For the interstitials that respond, execute the callback with the form body
|
||||
plugins.fireHook('filter:register.interstitial', {
|
||||
userData: req.session.registration,
|
||||
interstitials: []
|
||||
interstitials: [],
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -310,7 +310,7 @@ authenticationController.onSuccessfulLogin = function (req, uid, callback) {
|
||||
datetime: Date.now(),
|
||||
platform: req.useragent.platform,
|
||||
browser: req.useragent.browser,
|
||||
version: req.useragent.version
|
||||
version: req.useragent.version,
|
||||
});
|
||||
|
||||
// Associate login session with user
|
||||
@@ -323,7 +323,7 @@ authenticationController.onSuccessfulLogin = function (req, uid, callback) {
|
||||
},
|
||||
function (next) {
|
||||
user.updateLastOnlineTime(uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -369,7 +369,7 @@ authenticationController.localLogin = function (req, username, password, next) {
|
||||
},
|
||||
banned: function (next) {
|
||||
user.isBanned(uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (result, next) {
|
||||
@@ -408,7 +408,7 @@ authenticationController.localLogin = function (req, username, password, next) {
|
||||
}
|
||||
user.auth.clearLoginAttempts(uid);
|
||||
next(null, userData, '[[success:authentication-successful]]');
|
||||
}
|
||||
},
|
||||
], next);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,16 +13,16 @@ var categoriesController = {};
|
||||
categoriesController.list = function (req, res, next) {
|
||||
res.locals.metaTags = [{
|
||||
name: "title",
|
||||
content: validator.escape(String(meta.config.title || 'NodeBB'))
|
||||
content: validator.escape(String(meta.config.title || 'NodeBB')),
|
||||
}, {
|
||||
name: "description",
|
||||
content: validator.escape(String(meta.config.description || ''))
|
||||
content: validator.escape(String(meta.config.description || '')),
|
||||
}, {
|
||||
property: 'og:title',
|
||||
content: '[[pages:categories]]'
|
||||
content: '[[pages:categories]]',
|
||||
}, {
|
||||
property: 'og:type',
|
||||
content: 'website'
|
||||
content: 'website',
|
||||
}];
|
||||
|
||||
var ogImage = meta.config['og:image'] || meta.config['brand:logo'] || '';
|
||||
@@ -32,7 +32,7 @@ categoriesController.list = function (req, res, next) {
|
||||
}
|
||||
res.locals.metaTags.push({
|
||||
property: 'og:image',
|
||||
content: ogImage
|
||||
content: ogImage,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ categoriesController.list = function (req, res, next) {
|
||||
categories.flattenCategories(allCategories, categoryData);
|
||||
|
||||
categories.getRecentTopicReplies(allCategories, req.uid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -56,7 +56,7 @@ categoriesController.list = function (req, res, next) {
|
||||
|
||||
var data = {
|
||||
title: '[[pages:categories]]',
|
||||
categories: categoryData
|
||||
categories: categoryData,
|
||||
};
|
||||
|
||||
if (req.path.startsWith('/api/categories') || req.path.startsWith('/categories')) {
|
||||
@@ -68,7 +68,7 @@ categoriesController.list = function (req, res, next) {
|
||||
category.teaser = {
|
||||
url: nconf.get('relative_path') + '/topic/' + category.posts[0].topic.slug + '/' + category.posts[0].index,
|
||||
timestampISO: category.posts[0].timestampISO,
|
||||
pid: category.posts[0].pid
|
||||
pid: category.posts[0].pid,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ categoryController.get = function (req, res, callback) {
|
||||
},
|
||||
userSettings: function (next) {
|
||||
user.getSettings(req.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -97,7 +97,7 @@ categoryController.get = function (req, res, callback) {
|
||||
start: start,
|
||||
stop: stop,
|
||||
uid: req.uid,
|
||||
settings: settings
|
||||
settings: settings,
|
||||
};
|
||||
|
||||
async.waterfall([
|
||||
@@ -120,7 +120,7 @@ categoryController.get = function (req, res, callback) {
|
||||
}
|
||||
}
|
||||
categories.getCategoryById(payload, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
function (categoryData, next) {
|
||||
@@ -135,8 +135,8 @@ categoryController.get = function (req, res, callback) {
|
||||
var breadcrumbs = [
|
||||
{
|
||||
text: categoryData.name,
|
||||
url: nconf.get('relative_path') + '/category/' + categoryData.slug
|
||||
}
|
||||
url: nconf.get('relative_path') + '/category/' + categoryData.slug,
|
||||
},
|
||||
];
|
||||
helpers.buildCategoryBreadcrumbs(categoryData.parentCid, function (err, crumbs) {
|
||||
if (err) {
|
||||
@@ -155,7 +155,7 @@ categoryController.get = function (req, res, callback) {
|
||||
categories.getRecentTopicReplies(allCategories, req.uid, function (err) {
|
||||
next(err, categoryData);
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err, categoryData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -167,26 +167,26 @@ categoryController.get = function (req, res, callback) {
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: 'title',
|
||||
content: categoryData.name
|
||||
content: categoryData.name,
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: categoryData.name
|
||||
content: categoryData.name,
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
content: categoryData.description
|
||||
content: categoryData.description,
|
||||
},
|
||||
{
|
||||
property: "og:type",
|
||||
content: 'website'
|
||||
}
|
||||
content: 'website',
|
||||
},
|
||||
];
|
||||
|
||||
if (categoryData.backgroundImage) {
|
||||
res.locals.metaTags.push({
|
||||
name: 'og:image',
|
||||
content: categoryData.backgroundImage
|
||||
content: categoryData.backgroundImage,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -194,12 +194,12 @@ categoryController.get = function (req, res, callback) {
|
||||
{
|
||||
rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
href: nconf.get('url') + '/category/' + cid + '.rss'
|
||||
href: nconf.get('url') + '/category/' + cid + '.rss',
|
||||
},
|
||||
{
|
||||
rel: 'up',
|
||||
href: nconf.get('url')
|
||||
}
|
||||
href: nconf.get('url'),
|
||||
},
|
||||
];
|
||||
|
||||
if (parseInt(req.uid, 10)) {
|
||||
|
||||
@@ -40,7 +40,7 @@ groupsController.getGroupsFromSet = function (uid, sort, start, stop, callback)
|
||||
callback(null, {
|
||||
groups: groups,
|
||||
allowGroupCreation: parseInt(meta.config.allowGroupCreation, 10) === 1,
|
||||
nextStart: stop + 1
|
||||
nextStart: stop + 1,
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -58,7 +58,7 @@ groupsController.details = function (req, res, callback) {
|
||||
}
|
||||
async.parallel({
|
||||
exists: async.apply(groups.exists, groupName),
|
||||
hidden: async.apply(groups.isHidden, groupName)
|
||||
hidden: async.apply(groups.isHidden, groupName),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -70,7 +70,7 @@ groupsController.details = function (req, res, callback) {
|
||||
}
|
||||
async.parallel({
|
||||
isMember: async.apply(groups.isMember, req.uid, groupName),
|
||||
isInvited: async.apply(groups.isInvited, req.uid, groupName)
|
||||
isInvited: async.apply(groups.isInvited, req.uid, groupName),
|
||||
}, function (err, checks) {
|
||||
if (err || checks.isMember || checks.isInvited) {
|
||||
return next(err);
|
||||
@@ -84,7 +84,7 @@ groupsController.details = function (req, res, callback) {
|
||||
groups.get(groupName, {
|
||||
uid: req.uid,
|
||||
truncateUserList: true,
|
||||
userListCount: 20
|
||||
userListCount: 20,
|
||||
}, next);
|
||||
},
|
||||
posts: function (next) {
|
||||
@@ -95,9 +95,9 @@ groupsController.details = function (req, res, callback) {
|
||||
},
|
||||
isGlobalMod: function (next) {
|
||||
user.isGlobalModerator(req.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -129,7 +129,7 @@ groupsController.members = function (req, res, callback) {
|
||||
async.parallel({
|
||||
isAdminOrGlobalMod: async.apply(user.isAdminOrGlobalMod, req.uid),
|
||||
isMember: async.apply(groups.isMember, req.uid, groupName),
|
||||
isHidden: async.apply(groups.isHidden, groupName)
|
||||
isHidden: async.apply(groups.isHidden, groupName),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -147,14 +147,14 @@ groupsController.members = function (req, res, callback) {
|
||||
var breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{text: '[[pages:groups]]', url: '/groups' },
|
||||
{text: validator.escape(String(groupName)), url: '/groups/' + req.params.slug},
|
||||
{text: '[[groups:details.members]]'}
|
||||
{text: '[[groups:details.members]]'},
|
||||
]);
|
||||
|
||||
res.render('groups/members', {
|
||||
users: users,
|
||||
nextStart: 50,
|
||||
loadmore_display: users.length > 50 ? 'block' : 'hide',
|
||||
breadcrumbs: breadcrumbs
|
||||
breadcrumbs: breadcrumbs,
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -173,9 +173,9 @@ groupsController.uploadCover = function (req, res, next) {
|
||||
|
||||
groups.updateCover(req.uid, {
|
||||
file: req.files.files[0].path,
|
||||
groupName: params.groupName
|
||||
groupName: params.groupName,
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err, image) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
||||
@@ -17,7 +17,7 @@ helpers.notAllowed = function (req, res, error) {
|
||||
plugins.fireHook('filter:helpers.notAllowed', {
|
||||
req: req,
|
||||
res: res,
|
||||
error: error
|
||||
error: error,
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return winston.error(err);
|
||||
@@ -28,14 +28,14 @@ helpers.notAllowed = function (req, res, error) {
|
||||
path: req.path.replace(/^\/api/, ''),
|
||||
loggedIn: !!req.uid,
|
||||
error: error,
|
||||
title: '[[global:403.title]]'
|
||||
title: '[[global:403.title]]',
|
||||
});
|
||||
} else {
|
||||
res.status(403).render('403', {
|
||||
path: req.path,
|
||||
loggedIn: !!req.uid,
|
||||
error: error,
|
||||
title: '[[global:403.title]]'
|
||||
title: '[[global:403.title]]',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ helpers.buildCategoryBreadcrumbs = function (cid, callback) {
|
||||
if (!parseInt(data.disabled, 10)) {
|
||||
breadcrumbs.unshift({
|
||||
text: validator.escape(String(data.name)),
|
||||
url: nconf.get('relative_path') + '/category/' + data.slug
|
||||
url: nconf.get('relative_path') + '/category/' + data.slug,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ helpers.buildCategoryBreadcrumbs = function (cid, callback) {
|
||||
if (!meta.config.homePageRoute && meta.config.homePageCustom) {
|
||||
breadcrumbs.unshift({
|
||||
text: '[[global:header.categories]]',
|
||||
url: nconf.get('relative_path') + '/categories'
|
||||
url: nconf.get('relative_path') + '/categories',
|
||||
});
|
||||
}
|
||||
|
||||
breadcrumbs.unshift({
|
||||
text: '[[global:home]]',
|
||||
url: nconf.get('relative_path') + '/'
|
||||
url: nconf.get('relative_path') + '/',
|
||||
});
|
||||
|
||||
callback(null, breadcrumbs);
|
||||
@@ -104,8 +104,8 @@ helpers.buildBreadcrumbs = function (crumbs) {
|
||||
var breadcrumbs = [
|
||||
{
|
||||
text: '[[global:home]]',
|
||||
url: nconf.get('relative_path') + '/'
|
||||
}
|
||||
url: nconf.get('relative_path') + '/',
|
||||
},
|
||||
];
|
||||
|
||||
crumbs.forEach(function (crumb) {
|
||||
@@ -165,7 +165,7 @@ helpers.getWatchedCategories = function (uid, selectedCid, callback) {
|
||||
});
|
||||
|
||||
next(null, {categories: categoriesData, selectedCategory: selectedCategory});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ var Controllers = {
|
||||
admin: require('./admin'),
|
||||
globalMods: require('./globalmods'),
|
||||
mods: require('./mods'),
|
||||
sitemap: require('./sitemap')
|
||||
sitemap: require('./sitemap'),
|
||||
};
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Controllers.reset = function (req, res, next) {
|
||||
code: req.params.code,
|
||||
minimumPasswordLength: parseInt(meta.config.minimumPasswordLength, 10),
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]', url: '/reset'}, {text: '[[reset_password:update_password]]'}]),
|
||||
title: '[[pages:reset]]'
|
||||
title: '[[pages:reset]]',
|
||||
});
|
||||
|
||||
delete req.session.passwordExpired;
|
||||
@@ -93,7 +93,7 @@ Controllers.reset = function (req, res, next) {
|
||||
res.render('reset', {
|
||||
code: null,
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]'}]),
|
||||
title: '[[pages:reset]]'
|
||||
title: '[[pages:reset]]',
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -129,7 +129,7 @@ Controllers.login = function (req, res, next) {
|
||||
if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) {
|
||||
if (res.locals.isAPI) {
|
||||
return helpers.redirect(res, {
|
||||
external: data.authentication[0].url
|
||||
external: data.authentication[0].url,
|
||||
});
|
||||
} else {
|
||||
return res.redirect(nconf.get('relative_path') + data.authentication[0].url);
|
||||
@@ -172,7 +172,7 @@ Controllers.register = function (req, res, next) {
|
||||
},
|
||||
function (next) {
|
||||
plugins.fireHook('filter:parse.post', {postData: {content: meta.config.termsOfUse || ''}}, next);
|
||||
}
|
||||
},
|
||||
], function (err, termsOfUse) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -180,7 +180,7 @@ Controllers.register = function (req, res, next) {
|
||||
var loginStrategies = require('../routes/authentication').getLoginStrategies();
|
||||
var data = {
|
||||
'register_window:spansize': loginStrategies.length ? 'col-md-6' : 'col-md-12',
|
||||
'alternate_logins': !!loginStrategies.length
|
||||
'alternate_logins': !!loginStrategies.length,
|
||||
};
|
||||
|
||||
data.authentication = loginStrategies;
|
||||
@@ -205,7 +205,7 @@ Controllers.registerInterstitial = function (req, res, next) {
|
||||
|
||||
plugins.fireHook('filter:register.interstitial', {
|
||||
userData: req.session.registration,
|
||||
interstitials: []
|
||||
interstitials: [],
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -230,7 +230,7 @@ Controllers.registerInterstitial = function (req, res, next) {
|
||||
res.render('registerComplete', {
|
||||
title: '[[pages:registration-complete]]',
|
||||
errors: errors,
|
||||
sections: sections
|
||||
sections: sections,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -241,7 +241,7 @@ Controllers.compose = function (req, res, next) {
|
||||
req: req,
|
||||
res: res,
|
||||
next: next,
|
||||
templateData: {}
|
||||
templateData: {},
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -249,7 +249,7 @@ Controllers.compose = function (req, res, next) {
|
||||
|
||||
if (data.templateData.disabled) {
|
||||
res.render('', {
|
||||
title: '[[modules:composer.compose]]'
|
||||
title: '[[modules:composer.compose]]',
|
||||
});
|
||||
} else {
|
||||
data.templateData.title = '[[modules:composer.compose]]';
|
||||
@@ -285,7 +285,7 @@ Controllers.manifest = function (req, res) {
|
||||
start_url: nconf.get('relative_path') + '/',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
icons: []
|
||||
icons: [],
|
||||
};
|
||||
|
||||
if (meta.config['brand:touchIcon']) {
|
||||
@@ -293,32 +293,32 @@ Controllers.manifest = function (req, res) {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-36.png',
|
||||
sizes: '36x36',
|
||||
type: 'image/png',
|
||||
density: 0.75
|
||||
density: 0.75,
|
||||
}, {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-48.png',
|
||||
sizes: '48x48',
|
||||
type: 'image/png',
|
||||
density: 1.0
|
||||
density: 1.0,
|
||||
}, {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-72.png',
|
||||
sizes: '72x72',
|
||||
type: 'image/png',
|
||||
density: 1.5
|
||||
density: 1.5,
|
||||
}, {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-96.png',
|
||||
sizes: '96x96',
|
||||
type: 'image/png',
|
||||
density: 2.0
|
||||
density: 2.0,
|
||||
}, {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-144.png',
|
||||
sizes: '144x144',
|
||||
type: 'image/png',
|
||||
density: 3.0
|
||||
density: 3.0,
|
||||
}, {
|
||||
src: nconf.get('relative_path') + '/assets/uploads/system/touchicon-192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
density: 4.0
|
||||
density: 4.0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ Controllers.outgoing = function (req, res) {
|
||||
var data = {
|
||||
outgoing: validator.escape(String(url)),
|
||||
title: meta.config.title,
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[notifications:outgoing_link]]'}])
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[notifications:outgoing_link]]'}]),
|
||||
};
|
||||
|
||||
if (url) {
|
||||
@@ -359,7 +359,7 @@ Controllers.handle404 = function (req, res) {
|
||||
return plugins.fireHook('action:meta.override404', {
|
||||
req: req,
|
||||
res: res,
|
||||
error: {}
|
||||
error: {},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ Controllers.handleURIErrors = function (err, req, res, next) {
|
||||
winston.warn('[controller] Bad request: ' + req.path);
|
||||
if (res.locals.isAPI) {
|
||||
res.status(400).json({
|
||||
error: '[[global:400.title]]'
|
||||
error: '[[global:400.title]]',
|
||||
});
|
||||
} else {
|
||||
var middleware = require('../middleware');
|
||||
|
||||
@@ -10,7 +10,7 @@ var modsController = {};
|
||||
modsController.flagged = function (req, res, next) {
|
||||
async.parallel({
|
||||
isAdminOrGlobalMod: async.apply(user.isAdminOrGlobalMod, req.uid),
|
||||
moderatedCids: async.apply(user.getModeratedCids, req.uid)
|
||||
moderatedCids: async.apply(user.getModeratedCids, req.uid),
|
||||
}, function (err, results) {
|
||||
if (err || !(results.isAdminOrGlobalMod || !!results.moderatedCids.length)) {
|
||||
return next(err);
|
||||
|
||||
@@ -14,7 +14,7 @@ var lastUpdateTime = 0;
|
||||
var terms = {
|
||||
daily: 'day',
|
||||
weekly: 'week',
|
||||
monthly: 'month'
|
||||
monthly: 'month',
|
||||
};
|
||||
|
||||
popularController.get = function (req, res, next) {
|
||||
@@ -30,7 +30,7 @@ popularController.get = function (req, res, next) {
|
||||
day: '[[recent:day]]',
|
||||
week: '[[recent:week]]',
|
||||
month: '[[recent:month]]',
|
||||
alltime: '[[global:header.popular]]'
|
||||
alltime: '[[global:header.popular]]',
|
||||
};
|
||||
|
||||
if (!req.uid) {
|
||||
@@ -49,7 +49,7 @@ popularController.get = function (req, res, next) {
|
||||
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
|
||||
rssFeedUrl: nconf.get('relative_path') + '/popular/' + (req.params.term || 'daily') + '.rss',
|
||||
title: '[[pages:popular-' + term + ']]',
|
||||
term: term
|
||||
term: term,
|
||||
};
|
||||
|
||||
if (req.path.startsWith('/api/popular') || req.path.startsWith('/popular')) {
|
||||
|
||||
@@ -35,7 +35,7 @@ recentController.get = function (req, res, next) {
|
||||
},
|
||||
watchedCategories: function (next) {
|
||||
helpers.getWatchedCategories(req.uid, cid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -46,7 +46,7 @@ recentController.get = function (req, res, next) {
|
||||
stop = start + settings.topicsPerPage - 1;
|
||||
|
||||
topics.getRecentTopics(cid, req.uid, start, stop, filter, next);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -63,17 +63,17 @@ recentController.get = function (req, res, next) {
|
||||
name: '[[unread:all-topics]]',
|
||||
url: 'recent',
|
||||
selected: filter === '',
|
||||
filter: ''
|
||||
filter: '',
|
||||
}, {
|
||||
name: '[[unread:new-topics]]',
|
||||
url: 'recent/new',
|
||||
selected: filter === 'new',
|
||||
filter: 'new'
|
||||
filter: 'new',
|
||||
}, {
|
||||
name: '[[unread:watched-topics]]',
|
||||
url: 'recent/watched',
|
||||
selected: filter === 'watched',
|
||||
filter: 'watched'
|
||||
filter: 'watched',
|
||||
}];
|
||||
|
||||
data.selectedFilter = data.filters.find(function (filter) {
|
||||
|
||||
@@ -42,12 +42,12 @@ searchController.search = function (req, res, next) {
|
||||
sortDirection: req.query.sortDirection,
|
||||
page: page,
|
||||
uid: req.uid,
|
||||
qs: req.query
|
||||
qs: req.query,
|
||||
};
|
||||
|
||||
async.parallel({
|
||||
categories: async.apply(categories.buildForSelect, req.uid),
|
||||
search: async.apply(search.search, data)
|
||||
search: async.apply(search.search, data),
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -55,7 +55,7 @@ searchController.search = function (req, res, next) {
|
||||
|
||||
var categoriesData = [
|
||||
{value: 'all', text: '[[unread:all_categories]]'},
|
||||
{value: 'watched', text: '[[category:watched-categories]]'}
|
||||
{value: 'watched', text: '[[category:watched-categories]]'},
|
||||
].concat(results.categories);
|
||||
|
||||
var searchData = results.search;
|
||||
|
||||
@@ -20,7 +20,7 @@ tagsController.getTag = function (req, res, next) {
|
||||
topics: [],
|
||||
tag: tag,
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]', url: '/tags'}, {text: tag}]),
|
||||
title: '[[pages:tag, ' + tag + ']]'
|
||||
title: '[[pages:tag, ' + tag + ']]',
|
||||
};
|
||||
var settings;
|
||||
var topicCount = 0;
|
||||
@@ -39,7 +39,7 @@ tagsController.getTag = function (req, res, next) {
|
||||
},
|
||||
tids: function (next) {
|
||||
topics.getTagTids(req.params.tag, start, stop, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -48,7 +48,7 @@ tagsController.getTag = function (req, res, next) {
|
||||
}
|
||||
topicCount = results.topicCount;
|
||||
topics.getTopics(results.tids, req.uid, next);
|
||||
}
|
||||
},
|
||||
], function (err, topics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -57,16 +57,16 @@ tagsController.getTag = function (req, res, next) {
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: 'title',
|
||||
content: tag
|
||||
content: tag,
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: tag
|
||||
content: tag,
|
||||
},
|
||||
{
|
||||
property: 'og:url',
|
||||
content: nconf.get('url') + '/tags/' + tag
|
||||
}
|
||||
content: nconf.get('url') + '/tags/' + tag,
|
||||
},
|
||||
];
|
||||
templateData.topics = topics;
|
||||
|
||||
@@ -87,7 +87,7 @@ tagsController.getTags = function (req, res, next) {
|
||||
tags: tags,
|
||||
nextStart: 100,
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]'}]),
|
||||
title: '[[pages:tags]]'
|
||||
title: '[[pages:tags]]',
|
||||
};
|
||||
res.render('tags', data);
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ topicsController.get = function (req, res, callback) {
|
||||
},
|
||||
topic: function (next) {
|
||||
topics.getTopicData(tid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -132,11 +132,11 @@ topicsController.get = function (req, res, callback) {
|
||||
var breadcrumbs = [
|
||||
{
|
||||
text: data.topicData.category.name,
|
||||
url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug
|
||||
url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug,
|
||||
},
|
||||
{
|
||||
text: data.topicData.title
|
||||
}
|
||||
text: data.topicData.title,
|
||||
},
|
||||
];
|
||||
|
||||
helpers.buildCategoryBreadcrumbs(data.topicData.category.parentCid, function (err, crumbs) {
|
||||
@@ -188,70 +188,70 @@ topicsController.get = function (req, res, callback) {
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: "title",
|
||||
content: topicData.titleRaw
|
||||
content: topicData.titleRaw,
|
||||
},
|
||||
{
|
||||
name: "description",
|
||||
content: description
|
||||
content: description,
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: topicData.titleRaw
|
||||
content: topicData.titleRaw,
|
||||
},
|
||||
{
|
||||
property: 'og:description',
|
||||
content: description
|
||||
content: description,
|
||||
},
|
||||
{
|
||||
property: "og:type",
|
||||
content: 'article'
|
||||
content: 'article',
|
||||
},
|
||||
{
|
||||
property: "og:url",
|
||||
content: nconf.get('url') + '/topic/' + topicData.slug + (req.params.post_index ? ('/' + req.params.post_index) : ''),
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
},
|
||||
{
|
||||
property: 'og:image',
|
||||
content: ogImageUrl,
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
},
|
||||
{
|
||||
property: "og:image:url",
|
||||
content: ogImageUrl,
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
},
|
||||
{
|
||||
property: "article:published_time",
|
||||
content: utils.toISOString(topicData.timestamp)
|
||||
content: utils.toISOString(topicData.timestamp),
|
||||
},
|
||||
{
|
||||
property: 'article:modified_time',
|
||||
content: utils.toISOString(topicData.lastposttime)
|
||||
content: utils.toISOString(topicData.lastposttime),
|
||||
},
|
||||
{
|
||||
property: 'article:section',
|
||||
content: topicData.category ? topicData.category.name : ''
|
||||
}
|
||||
content: topicData.category ? topicData.category.name : '',
|
||||
},
|
||||
];
|
||||
|
||||
res.locals.linkTags = [
|
||||
{
|
||||
rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
href: nconf.get('url') + '/topic/' + tid + '.rss'
|
||||
}
|
||||
href: nconf.get('url') + '/topic/' + tid + '.rss',
|
||||
},
|
||||
];
|
||||
|
||||
if (topicData.category) {
|
||||
res.locals.linkTags.push({
|
||||
rel: 'up',
|
||||
href: nconf.get('url') + '/category/' + topicData.category.slug
|
||||
href: nconf.get('url') + '/category/' + topicData.category.slug,
|
||||
});
|
||||
}
|
||||
|
||||
next(null, topicData);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -317,7 +317,7 @@ topicsController.teaser = function (req, res, next) {
|
||||
return res.status(404).json('not-found');
|
||||
}
|
||||
posts.getPostSummaryByPids([pid], req.uid, {stripTags: false}, next);
|
||||
}
|
||||
},
|
||||
], function (err, posts) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -341,7 +341,7 @@ topicsController.pagination = function (req, res, callback) {
|
||||
async.parallel({
|
||||
privileges: async.apply(privileges.topics.get, tid, req.uid),
|
||||
settings: async.apply(user.getSettings, req.uid),
|
||||
topic: async.apply(topics.getTopicData, tid)
|
||||
topic: async.apply(topics.getTopicData, tid),
|
||||
}, function (err, results) {
|
||||
if (err || !results.topic) {
|
||||
return callback(err);
|
||||
|
||||
@@ -32,7 +32,7 @@ unreadController.get = function (req, res, next) {
|
||||
},
|
||||
settings: function (next) {
|
||||
user.getSettings(req.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (_results, next) {
|
||||
@@ -41,7 +41,7 @@ unreadController.get = function (req, res, next) {
|
||||
var start = Math.max(0, (page - 1) * settings.topicsPerPage);
|
||||
var stop = start + settings.topicsPerPage - 1;
|
||||
topics.getUnreadTopics(cid, req.uid, start, stop, filter, next);
|
||||
}
|
||||
},
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -67,17 +67,17 @@ unreadController.get = function (req, res, next) {
|
||||
name: '[[unread:all-topics]]',
|
||||
url: 'unread',
|
||||
selected: filter === '',
|
||||
filter: ''
|
||||
filter: '',
|
||||
}, {
|
||||
name: '[[unread:new-topics]]',
|
||||
url: 'unread/new',
|
||||
selected: filter === 'new',
|
||||
filter: 'new'
|
||||
filter: 'new',
|
||||
}, {
|
||||
name: '[[unread:watched-topics]]',
|
||||
url: 'unread/watched',
|
||||
selected: filter === 'watched',
|
||||
filter: 'watched'
|
||||
filter: 'watched',
|
||||
}];
|
||||
|
||||
data.selectedFilter = data.filters.find(function (filter) {
|
||||
|
||||
@@ -72,7 +72,7 @@ function uploadAsImage(req, uploadedFile, callback) {
|
||||
}
|
||||
|
||||
resizeImage(fileObj, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ function uploadAsFile(req, uploadedFile, callback) {
|
||||
return next(new Error('[[error:uploads-are-disabled]]'));
|
||||
}
|
||||
uploadFile(req.uid, uploadedFile, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ function resizeImage(fileObj, callback) {
|
||||
path: fileObj.path,
|
||||
target: path.join(dirname, basename + '-resized' + extname),
|
||||
extension: extname,
|
||||
width: parseInt(meta.config.maximumImageWidth, 10) || 760
|
||||
width: parseInt(meta.config.maximumImageWidth, 10) || 760,
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -124,7 +124,7 @@ function resizeImage(fileObj, callback) {
|
||||
fileObj.url = path.join(dirname, basename + '-resized' + extname);
|
||||
|
||||
next(null, fileObj);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ uploadsController.uploadThumb = function (req, res, next) {
|
||||
path: uploadedFile.path,
|
||||
extension: path.extname(uploadedFile.name),
|
||||
width: size,
|
||||
height: size
|
||||
height: size,
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -223,7 +223,7 @@ function saveFileToLocal(uploadedFile, callback) {
|
||||
callback(null, {
|
||||
url: nconf.get('relative_path') + upload.url,
|
||||
path: upload.path,
|
||||
name: uploadedFile.name
|
||||
name: uploadedFile.name,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ usersController.index = function (req, res, next) {
|
||||
'sort-posts': usersController.getUsersSortedByPosts,
|
||||
'sort-reputation': usersController.getUsersSortedByReputation,
|
||||
banned: usersController.getBannedUsers,
|
||||
flagged: usersController.getFlaggedUsers
|
||||
flagged: usersController.getFlaggedUsers,
|
||||
};
|
||||
|
||||
if (req.query.term) {
|
||||
@@ -42,12 +42,12 @@ usersController.search = function (req, res, next) {
|
||||
sortBy: req.query.sortBy,
|
||||
onlineOnly: req.query.onlineOnly === 'true',
|
||||
bannedOnly: req.query.bannedOnly === 'true',
|
||||
flaggedOnly: req.query.flaggedOnly === 'true'
|
||||
flaggedOnly: req.query.flaggedOnly === 'true',
|
||||
}, next);
|
||||
},
|
||||
isAdminOrGlobalMod: function (next) {
|
||||
user.isAdminOrGlobalMod(req.uid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -69,7 +69,7 @@ usersController.getOnlineUsers = function (req, res, next) {
|
||||
},
|
||||
guests: function (next) {
|
||||
require('../socket.io/admin/rooms').getTotalGuestCount(next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -175,7 +175,7 @@ usersController.getUsers = function (set, uid, query, callback) {
|
||||
},
|
||||
usersData: function (next) {
|
||||
usersController.getUsersAndCount(set, uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -188,7 +188,7 @@ usersController.getUsers = function (set, uid, query, callback) {
|
||||
userCount: results.usersData.count,
|
||||
title: setToData[set].title || '[[pages:users/latest]]',
|
||||
breadcrumbs: helpers.buildBreadcrumbs(breadcrumbs),
|
||||
isAdminOrGlobalMod: results.isAdminOrGlobalMod
|
||||
isAdminOrGlobalMod: results.isAdminOrGlobalMod,
|
||||
};
|
||||
userData['section_' + (query.section || 'joindate')] = true;
|
||||
callback(null, userData);
|
||||
@@ -211,7 +211,7 @@ usersController.getUsersAndCount = function (set, uid, start, stop, callback) {
|
||||
} else {
|
||||
db.getObjectField('global', 'userCount', next);
|
||||
}
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
Reference in New Issue
Block a user