mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-27 00:55:33 +02:00
ESlint comma-dangle
This commit is contained in:
@@ -193,7 +193,7 @@ Analytics.getCategoryAnalytics = function (cid, callback) {
|
||||
Analytics.getErrorAnalytics = function (callback) {
|
||||
async.parallel({
|
||||
'not-found': async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:404', Date.now(), 7),
|
||||
'toobusy': async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:503', Date.now(), 7)
|
||||
'toobusy': async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:503', Date.now(), 7),
|
||||
}, callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ exports.processSortedSet = function (setKey, process, options, callback) {
|
||||
});
|
||||
});
|
||||
},
|
||||
callback
|
||||
callback,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -105,6 +105,6 @@ exports.processArray = function (array, process, options, callback) {
|
||||
},
|
||||
function (err) {
|
||||
callback(err);
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ var privileges = require('./privileges');
|
||||
},
|
||||
isIgnored: function (next) {
|
||||
Categories.isIgnored([data.cid], data.uid, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -62,7 +62,7 @@ var privileges = require('./privileges');
|
||||
},
|
||||
function (data, next) {
|
||||
next(null, data.category);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ var privileges = require('./privileges');
|
||||
Categories.getPageCount = function (cid, uid, callback) {
|
||||
async.parallel({
|
||||
topicCount: async.apply(Categories.getCategoryField, cid, 'topic_count'),
|
||||
settings: async.apply(user.getSettings, uid)
|
||||
settings: async.apply(user.getSettings, uid),
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -107,7 +107,7 @@ var privileges = require('./privileges');
|
||||
},
|
||||
function (cids, next) {
|
||||
Categories.getCategories(cids, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ var privileges = require('./privileges');
|
||||
},
|
||||
hasRead: function (next) {
|
||||
Categories.hasReadCategories(cids, uid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -224,7 +224,7 @@ var privileges = require('./privileges');
|
||||
return parentData[parentCids.indexOf(parseInt(category.parentCid, 10))];
|
||||
});
|
||||
next(null, parentData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -266,7 +266,7 @@ var privileges = require('./privileges');
|
||||
async.each(category.children, function (child, next) {
|
||||
getChildrenRecursive(child, uid, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ var privileges = require('./privileges');
|
||||
return uid && !isIgnoring[index];
|
||||
});
|
||||
next(null, readingUids);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = function (Categories) {
|
||||
});
|
||||
|
||||
next(null, uids);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = function (Categories) {
|
||||
link: '',
|
||||
numRecentReplies: 1,
|
||||
class: ( data.class ? data.class : 'col-md-3 col-xs-6' ),
|
||||
imageClass: 'cover'
|
||||
imageClass: 'cover',
|
||||
};
|
||||
|
||||
plugins.fireHook('filter:category.create', {category: category, data: data}, next);
|
||||
@@ -63,7 +63,7 @@ module.exports = function (Categories) {
|
||||
async.apply(db.sortedSetAdd, 'cid:' + parentCid + ':children', category.order, category.cid),
|
||||
async.apply(privileges.categories.give, defaultPrivileges, category.cid, 'administrators'),
|
||||
async.apply(privileges.categories.give, defaultPrivileges, category.cid, 'registered-users'),
|
||||
async.apply(privileges.categories.give, ['find', 'read', 'topics:read'], category.cid, 'guests')
|
||||
async.apply(privileges.categories.give, ['find', 'read', 'topics:read'], category.cid, 'guests'),
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -75,7 +75,7 @@ module.exports = function (Categories) {
|
||||
function (category, next) {
|
||||
plugins.fireHook('action:category.create', category);
|
||||
next(null, category);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -93,7 +93,7 @@ module.exports = function (Categories) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
source: async.apply(db.getObject, 'category:' + fromCid),
|
||||
destination: async.apply(db.getObject, 'category:' + toCid)
|
||||
destination: async.apply(db.getObject, 'category:' + toCid),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -132,7 +132,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (results, next) {
|
||||
Categories.copyPrivilegesFrom(fromCid, toCid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err, destination);
|
||||
});
|
||||
@@ -165,7 +165,7 @@ module.exports = function (Categories) {
|
||||
async.eachSeries(members, function (member, next) {
|
||||
groups.join('cid:' + toCid + ':privileges:' + privilege, member, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ module.exports = function (Categories) {
|
||||
async.apply(db.getSortedSetRange, 'categories:cid', 0, -1),
|
||||
function (cids, next) {
|
||||
Categories.getCategoriesFields(cids, fields, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = function (Categories) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:category.delete', cid);
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -55,14 +55,14 @@ module.exports = function (Categories) {
|
||||
'cid:' + cid + ':ignorers',
|
||||
'cid:' + cid + ':children',
|
||||
'cid:' + cid + ':tag:whitelist',
|
||||
'category:' + cid
|
||||
'category:' + cid,
|
||||
], next);
|
||||
},
|
||||
function (next) {
|
||||
async.each(privileges.privilegeList, function (privilege, next) {
|
||||
groups.destroy('cid:' + cid + ':privileges:' + privilege, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -77,7 +77,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
children: function (next) {
|
||||
db.getSortedSetRange('cid:' + cid + ':children', 0, -1, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -94,12 +94,12 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:0:children', cid, cid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (pids, next) {
|
||||
posts.getPostSummaryByPids(pids, uid, {stripTags: true}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
numRecentReplies: function (next) {
|
||||
db.getObjectField('category:' + cid, 'numRecentReplies', next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -61,7 +61,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':recent_tids', Date.now(), tid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
};
|
||||
@@ -95,7 +95,7 @@ module.exports = function (Categories) {
|
||||
bubbleUpChildrenPosts(categoryData);
|
||||
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -135,13 +135,13 @@ module.exports = function (Categories) {
|
||||
teaser.tid = teaser.uid = teaser.user.uid = undefined;
|
||||
teaser.topic = {
|
||||
slug: topicData[index].slug,
|
||||
title: validator.escape(String(topicData[index].title))
|
||||
title: validator.escape(String(topicData[index].title)),
|
||||
};
|
||||
}
|
||||
});
|
||||
results.teasers = results.teasers.filter(Boolean);
|
||||
next(null, results.teasers);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -211,9 +211,9 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':pids', timestamps, pids, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
@@ -238,7 +238,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.incrObjectFieldBy('category:' + newCid, 'post_count', postCount, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error(err.message);
|
||||
|
||||
@@ -32,7 +32,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (results, next) {
|
||||
next(null, {topics: results.topics, nextStart: data.stop + 1});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ module.exports = function (Categories) {
|
||||
});
|
||||
|
||||
next(null, pinnedTids.concat(normalTids));
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -132,14 +132,14 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetIncrBy('cid:' + cid + ':tids:posts', 1, postData.tid, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
},
|
||||
function (next) {
|
||||
Categories.updateRecentTid(cid, postData.tid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ module.exports = function (Categories) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:category.update', {cid: cid, modified: category});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ module.exports = function (Categories) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -108,9 +108,9 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (next) {
|
||||
db.setObjectField('category:' + cid, 'parentCid', newParent, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -131,7 +131,7 @@ module.exports = function (Categories) {
|
||||
return index;
|
||||
});
|
||||
db.sortedSetAdd('cid:' + cid + ':tag:whitelist', scores, tags, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -148,9 +148,9 @@ module.exports = function (Categories) {
|
||||
function (next) {
|
||||
parentCid = parseInt(parentCid, 10) || 0;
|
||||
db.sortedSetAdd('cid:' + parentCid + ':children', order, cid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -163,7 +163,7 @@ module.exports = function (Categories) {
|
||||
},
|
||||
function (parsedDescription, next) {
|
||||
Categories.setCategoryField(cid, 'descriptionParsed', parsedDescription, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -17,30 +17,30 @@
|
||||
{
|
||||
name: 'mongo:host',
|
||||
description: 'Host IP or address of your MongoDB instance',
|
||||
'default': nconf.get('mongo:host') || '127.0.0.1'
|
||||
'default': nconf.get('mongo:host') || '127.0.0.1',
|
||||
},
|
||||
{
|
||||
name: 'mongo:port',
|
||||
description: 'Host port of your MongoDB instance',
|
||||
'default': nconf.get('mongo:port') || 27017
|
||||
'default': nconf.get('mongo:port') || 27017,
|
||||
},
|
||||
{
|
||||
name: 'mongo:username',
|
||||
description: 'MongoDB username',
|
||||
'default': nconf.get('mongo:username') || ''
|
||||
'default': nconf.get('mongo:username') || '',
|
||||
},
|
||||
{
|
||||
name: 'mongo:password',
|
||||
description: 'Password of your MongoDB database',
|
||||
hidden: true,
|
||||
default: nconf.get('mongo:password') || '',
|
||||
before: function (value) { value = value || nconf.get('mongo:password') || ''; return value; }
|
||||
before: function (value) { value = value || nconf.get('mongo:password') || ''; return value; },
|
||||
},
|
||||
{
|
||||
name: "mongo:database",
|
||||
description: "MongoDB database name",
|
||||
'default': nconf.get('mongo:database') || 'nodebb'
|
||||
}
|
||||
'default': nconf.get('mongo:database') || 'nodebb',
|
||||
},
|
||||
];
|
||||
|
||||
module.helpers = module.helpers || {};
|
||||
@@ -84,8 +84,8 @@
|
||||
|
||||
var connOptions = {
|
||||
server: {
|
||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10
|
||||
}
|
||||
poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10,
|
||||
},
|
||||
};
|
||||
|
||||
connOptions = _.deepExtend((nconf.get('mongo:options') || {}), connOptions);
|
||||
@@ -135,13 +135,13 @@
|
||||
|
||||
module.sessionStore = new sessionStore({
|
||||
client: rdb.client,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
} else if (nconf.get('mongo')) {
|
||||
sessionStore = require('connect-mongo')(session);
|
||||
module.sessionStore = new sessionStore({
|
||||
db: db,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
async.series([
|
||||
async.apply(createIndex, 'objects', { _key: 1, score: -1 }, { background: true }),
|
||||
async.apply(createIndex, 'objects', { _key: 1, value: -1 }, { background: true, unique: true, sparse: true }),
|
||||
async.apply(createIndex, 'objects', { expireAt: 1 }, { expireAfterSeconds: 0, background: true })
|
||||
async.apply(createIndex, 'objects', { expireAt: 1 }, { expireAfterSeconds: 0, background: true }),
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('Error creating index ' + err.message);
|
||||
@@ -203,7 +203,7 @@
|
||||
db.collection(collection.name).stats(next);
|
||||
}, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -219,7 +219,7 @@
|
||||
avgObjSize: collectionInfo.avgObjSize,
|
||||
storageSize: collectionInfo.storageSize,
|
||||
totalIndexSize: collectionInfo.totalIndexSize,
|
||||
indexSizes: collectionInfo.indexSizes
|
||||
indexSizes: collectionInfo.indexSizes,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ module.exports = function (db, module) {
|
||||
}
|
||||
field = helpers.fieldToString(field);
|
||||
var _fields = {
|
||||
_id: 0
|
||||
_id: 0,
|
||||
};
|
||||
_fields[field] = 1;
|
||||
db.collection('objects').findOne({_key: key}, {fields: _fields}, function (err, item) {
|
||||
@@ -75,7 +75,7 @@ module.exports = function (db, module) {
|
||||
return callback();
|
||||
}
|
||||
var _fields = {
|
||||
_id: 0
|
||||
_id: 0,
|
||||
};
|
||||
|
||||
for(var i = 0; i < fields.length; ++i) {
|
||||
@@ -101,7 +101,7 @@ module.exports = function (db, module) {
|
||||
}
|
||||
var _fields = {
|
||||
_id: 0,
|
||||
_key: 1
|
||||
_key: 1,
|
||||
};
|
||||
|
||||
for(var i = 0; i < fields.length; ++i) {
|
||||
|
||||
@@ -14,16 +14,16 @@ module.exports = function (db, module) {
|
||||
});
|
||||
|
||||
db.collection('objects').update({
|
||||
_key: key
|
||||
_key: key,
|
||||
}, {
|
||||
$addToSet: {
|
||||
members: {
|
||||
$each: value
|
||||
}
|
||||
}
|
||||
$each: value,
|
||||
},
|
||||
},
|
||||
}, {
|
||||
upsert: true,
|
||||
w: 1
|
||||
w: 1,
|
||||
}, function (err, res) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -49,8 +49,8 @@ module.exports = function (db, module) {
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
bulk.find({_key: keys[i]}).upsert().updateOne({ $addToSet: {
|
||||
members: {
|
||||
$each: value
|
||||
}
|
||||
$each: value,
|
||||
},
|
||||
}});
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ module.exports = function (db, module) {
|
||||
|
||||
for(var i = 0; i < keys.length; ++i) {
|
||||
bulk.find({_key: keys[i]}).updateOne({$pull: {
|
||||
members: value
|
||||
members: value,
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match : { _key : { $in: keys } } } ,
|
||||
{ $group: { _id: {_key: '$_key'}, count: { $sum: 1 } } },
|
||||
{ $project: { _id: 1, count: '$count' } }
|
||||
{ $project: { _id: 1, count: '$count' } },
|
||||
];
|
||||
db.collection('objects').aggregate(pipeline, function (err, results) {
|
||||
if (err) {
|
||||
@@ -500,7 +500,7 @@ module.exports = function (db, module) {
|
||||
});
|
||||
});
|
||||
},
|
||||
callback
|
||||
callback,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = function (db, module) {
|
||||
{ $match: { _key: {$in: keys}} },
|
||||
{ $group: { _id: {value: '$value'}, count: {$sum: 1}} },
|
||||
{ $match: { count: keys.length} },
|
||||
{ $group: { _id: null, count: { $sum: 1 } } }
|
||||
{ $group: { _id: null, count: { $sum: 1 } } },
|
||||
];
|
||||
|
||||
db.collection('objects').aggregate(pipeline, function (err, data) {
|
||||
@@ -56,9 +56,9 @@ module.exports = function (db, module) {
|
||||
$project: {
|
||||
value: 1,
|
||||
score: {
|
||||
$cond: { if: { $eq: [ "$_key", sets[index] ] }, then: { $multiply: [ '$score', weight ] }, else: '$score' }
|
||||
}
|
||||
}
|
||||
$cond: { if: { $eq: [ "$_key", sets[index] ] }, then: { $multiply: [ '$score', weight ] }, else: '$score' },
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match: { _key: {$in: keys} } },
|
||||
{ $group: { _id: {value: '$value' } } },
|
||||
{ $group: { _id: null, count: { $sum: 1 } } }
|
||||
{ $group: { _id: null, count: { $sum: 1 } } },
|
||||
];
|
||||
|
||||
var project = { _id: 0, count: '$count' };
|
||||
@@ -50,7 +50,7 @@ module.exports = function (db, module) {
|
||||
var pipeline = [
|
||||
{ $match: { _key: {$in: params.sets}} },
|
||||
{ $group: { _id: {value: '$value'}, totalScore: aggregate} },
|
||||
{ $sort: { totalScore: params.sort} }
|
||||
{ $sort: { totalScore: params.sort} },
|
||||
];
|
||||
|
||||
if (params.start) {
|
||||
|
||||
@@ -14,25 +14,25 @@
|
||||
{
|
||||
name: 'redis:host',
|
||||
description: 'Host IP or address of your Redis instance',
|
||||
'default': nconf.get('redis:host') || '127.0.0.1'
|
||||
'default': nconf.get('redis:host') || '127.0.0.1',
|
||||
},
|
||||
{
|
||||
name: 'redis:port',
|
||||
description: 'Host port of your Redis instance',
|
||||
'default': nconf.get('redis:port') || 6379
|
||||
'default': nconf.get('redis:port') || 6379,
|
||||
},
|
||||
{
|
||||
name: 'redis:password',
|
||||
description: 'Password of your Redis database',
|
||||
hidden: true,
|
||||
default: nconf.get('redis:password') || '',
|
||||
before: function (value) { value = value || nconf.get('redis:password') || ''; return value; }
|
||||
before: function (value) { value = value || nconf.get('redis:password') || ''; return value; },
|
||||
},
|
||||
{
|
||||
name: "redis:database",
|
||||
description: "Which database to use (0..n)",
|
||||
'default': nconf.get('redis:database') || 0
|
||||
}
|
||||
'default': nconf.get('redis:database') || 0,
|
||||
},
|
||||
];
|
||||
|
||||
module.init = function (callback) {
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
module.sessionStore = new sessionStore({
|
||||
client: module.client,
|
||||
ttl: ttl
|
||||
ttl: ttl,
|
||||
});
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
|
||||
@@ -17,7 +17,7 @@ var translator = require('../public/src/modules/translator');
|
||||
|
||||
var transports = {
|
||||
sendmail: nodemailer.createTransport(sendmailTransport()),
|
||||
gmail: undefined
|
||||
gmail: undefined,
|
||||
};
|
||||
|
||||
var app;
|
||||
@@ -35,8 +35,8 @@ var fallbackTransport;
|
||||
secure: true,
|
||||
auth: {
|
||||
user: meta.config['email:GmailTransport:user'],
|
||||
pass: meta.config['email:GmailTransport:pass']
|
||||
}
|
||||
pass: meta.config['email:GmailTransport:pass'],
|
||||
},
|
||||
}));
|
||||
} else {
|
||||
fallbackTransport = transports.sendmail;
|
||||
@@ -56,7 +56,7 @@ var fallbackTransport;
|
||||
function (next) {
|
||||
async.parallel({
|
||||
email: async.apply(User.getUserField, uid, 'email'),
|
||||
settings: async.apply(User.getSettings, uid)
|
||||
settings: async.apply(User.getSettings, uid),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -66,7 +66,7 @@ var fallbackTransport;
|
||||
}
|
||||
params.uid = uid;
|
||||
Emailer.sendToEmail(template, results.email, results.settings.userLang, params, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -85,7 +85,7 @@ var fallbackTransport;
|
||||
translator.translate(params.subject, lang, function (translated) {
|
||||
next(null, translated);
|
||||
});
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -97,12 +97,12 @@ var fallbackTransport;
|
||||
subject: results.subject,
|
||||
html: results.html,
|
||||
plaintext: htmlToText.fromString(results.html, {
|
||||
ignoreImage: true
|
||||
ignoreImage: true,
|
||||
}),
|
||||
template: template,
|
||||
uid: params.uid,
|
||||
pid: params.pid,
|
||||
fromUid: params.fromUid
|
||||
fromUid: params.fromUid,
|
||||
};
|
||||
Plugins.fireHook('filter:email.modify', data, next);
|
||||
},
|
||||
@@ -112,7 +112,7 @@ var fallbackTransport;
|
||||
} else {
|
||||
Emailer.sendViaFallback(data, next);
|
||||
}
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
callback(new Error('[[error:sendmail-not-found]]'));
|
||||
|
||||
@@ -27,9 +27,9 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (next) {
|
||||
db.setObject('event:' + eid, data, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err, result) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -66,7 +66,7 @@ var utils = require('../public/src/utils');
|
||||
event.timestampISO = new Date(parseInt(event.timestamp, 10)).toUTCString();
|
||||
});
|
||||
next(null, eventsData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -87,7 +87,7 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
userData: function (next) {
|
||||
user.getUsersFields(uids, ['username', 'userslug', 'picture'], next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -121,7 +121,7 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetRemove('events:time', eids, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ file.saveFileToLocal = function (filename, folder, tempPath, callback) {
|
||||
is.on('end', function () {
|
||||
callback(null, {
|
||||
url: '/assets/uploads/' + folder + '/' + filename,
|
||||
path: uploadPath
|
||||
path: uploadPath,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ file.base64ToLocal = function (imageData, uploadPath, callback) {
|
||||
uploadPath = path.join(nconf.get('upload_path'), uploadPath);
|
||||
|
||||
fs.writeFile(uploadPath, buffer, {
|
||||
encoding: 'base64'
|
||||
encoding: 'base64',
|
||||
}, function (err) {
|
||||
callback(err, uploadPath);
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ var utils = require('../public/src/utils');
|
||||
description: '',
|
||||
deleted: '0',
|
||||
hidden: '0',
|
||||
system: '1'
|
||||
system: '1',
|
||||
};
|
||||
},
|
||||
removeEphemeralGroups: function (groups) {
|
||||
@@ -42,7 +42,7 @@ var utils = require('../public/src/utils');
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Groups.internals = internals;
|
||||
@@ -73,7 +73,7 @@ var utils = require('../public/src/utils');
|
||||
}
|
||||
|
||||
Groups.getGroupsAndMembers(groupNames, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
members: function (next) {
|
||||
Groups.getMemberUsers(groupNames, 0, 3, next);
|
||||
}
|
||||
},
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -132,7 +132,7 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (uids, next) {
|
||||
user.getUsersData(uids, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
invited: function (next) {
|
||||
@@ -142,13 +142,13 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (uids, next) {
|
||||
user.getUsersData(uids, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
isMember: async.apply(Groups.isMember, options.uid, groupName),
|
||||
isPending: async.apply(Groups.isPending, options.uid, groupName),
|
||||
isInvited: async.apply(Groups.isInvited, options.uid, groupName),
|
||||
isOwner: async.apply(Groups.ownership.isOwner, options.uid, groupName)
|
||||
isOwner: async.apply(Groups.ownership.isOwner, options.uid, groupName),
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -206,12 +206,12 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (uids, next) {
|
||||
user.getUsers(uids, uid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
},
|
||||
members: function (next) {
|
||||
user.getUsersFromSet('group:' + groupName + ':members', uid, start, stop, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -312,7 +312,7 @@ var utils = require('../public/src/utils');
|
||||
return ephemeralGroups.indexOf(slug) !== -1;
|
||||
}));
|
||||
},
|
||||
async.apply(db.isSortedSetMembers, 'groups:createtime', name)
|
||||
async.apply(db.isSortedSetMembers, 'groups:createtime', name),
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -327,7 +327,7 @@ var utils = require('../public/src/utils');
|
||||
function (next) {
|
||||
next(null, ephemeralGroups.indexOf(slug) !== -1);
|
||||
},
|
||||
async.apply(db.isSortedSetMember, 'groups:createtime', name)
|
||||
async.apply(db.isSortedSetMember, 'groups:createtime', name),
|
||||
], function (err, results) {
|
||||
callback(err, !err ? (results[0] || results[1]) : null);
|
||||
});
|
||||
@@ -361,7 +361,7 @@ var utils = require('../public/src/utils');
|
||||
},
|
||||
function (pids, next) {
|
||||
posts.getPostSummaryByPids(pids, uid, {stripTags: false}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -452,7 +452,7 @@ var utils = require('../public/src/utils');
|
||||
Groups.getGroupsData(memberOf, next);
|
||||
});
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ module.exports = function (Groups) {
|
||||
uploadsController.uploadGroupCover(uid, {
|
||||
name: 'groupCover',
|
||||
path: tempPath,
|
||||
type: type
|
||||
type: type,
|
||||
}, next);
|
||||
},
|
||||
function (uploadData, next) {
|
||||
@@ -58,7 +58,7 @@ module.exports = function (Groups) {
|
||||
uploadsController.uploadGroupCover(uid, {
|
||||
name: 'groupCoverThumb',
|
||||
path: tempPath,
|
||||
type: type
|
||||
type: type,
|
||||
}, next);
|
||||
},
|
||||
function (uploadData, next) {
|
||||
@@ -70,7 +70,7 @@ module.exports = function (Groups) {
|
||||
} else {
|
||||
next(null);
|
||||
}
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
fs.unlink(tempPath, function (unlinkErr) {
|
||||
if (unlinkErr) {
|
||||
@@ -91,7 +91,7 @@ module.exports = function (Groups) {
|
||||
},
|
||||
function (image, next) {
|
||||
image.write(path, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -109,7 +109,7 @@ module.exports = function (Groups) {
|
||||
var buffer = new Buffer(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
|
||||
|
||||
fs.writeFile(tempPath, buffer, {
|
||||
encoding: 'base64'
|
||||
encoding: 'base64',
|
||||
}, function (err) {
|
||||
callback(err, tempPath);
|
||||
});
|
||||
|
||||
@@ -42,14 +42,14 @@ module.exports = function (Groups) {
|
||||
hidden: parseInt(data.hidden, 10) === 1 ? 1 : 0,
|
||||
system: system ? 1 : 0,
|
||||
private: isPrivate,
|
||||
disableJoinRequests: disableJoinRequests
|
||||
disableJoinRequests: disableJoinRequests,
|
||||
};
|
||||
plugins.fireHook('filter:group.create', {group: groupData, data: data}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
var tasks = [
|
||||
async.apply(db.sortedSetAdd, 'groups:createtime', groupData.createtime, groupData.name),
|
||||
async.apply(db.setObject, 'group:' + groupData.name, groupData)
|
||||
async.apply(db.setObject, 'group:' + groupData.name, groupData),
|
||||
];
|
||||
|
||||
if (data.hasOwnProperty('ownerUid')) {
|
||||
@@ -72,7 +72,7 @@ module.exports = function (Groups) {
|
||||
function (results, next) {
|
||||
plugins.fireHook('action:group.create', groupData);
|
||||
next(null, groupData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ module.exports = function (Groups) {
|
||||
db.sortedSetRemove('group:' + group + ':members', groupName, next);
|
||||
}, next);
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
@@ -15,7 +15,7 @@ var LRU = require('lru-cache');
|
||||
|
||||
var cache = LRU({
|
||||
max: 40000,
|
||||
maxAge: 1000 * 60 * 60
|
||||
maxAge: 1000 * 60 * 60,
|
||||
});
|
||||
|
||||
module.exports = function (Groups) {
|
||||
@@ -46,7 +46,7 @@ module.exports = function (Groups) {
|
||||
Groups.create({
|
||||
name: groupName,
|
||||
description: '',
|
||||
hidden: 1
|
||||
hidden: 1,
|
||||
}, function (err) {
|
||||
if (err && err.message !== '[[error:group-already-exists]]') {
|
||||
winston.error('[groups.join] Could not create new hidden group: ' + err.message);
|
||||
@@ -62,13 +62,13 @@ module.exports = function (Groups) {
|
||||
},
|
||||
isHidden: function (next) {
|
||||
Groups.isHidden(groupName, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
var tasks = [
|
||||
async.apply(db.sortedSetAdd, 'group:' + groupName + ':members', Date.now(), uid),
|
||||
async.apply(db.incrObjectField, 'group:' + groupName, 'memberCount')
|
||||
async.apply(db.incrObjectField, 'group:' + groupName, 'memberCount'),
|
||||
];
|
||||
if (results.isAdmin) {
|
||||
tasks.push(async.apply(db.setAdd, 'group:' + groupName + ':owners', uid));
|
||||
@@ -85,10 +85,10 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:group.join', {
|
||||
groupName: groupName,
|
||||
uid: uid
|
||||
uid: uid,
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -120,12 +120,12 @@ module.exports = function (Groups) {
|
||||
bodyLong: '[[groups:request.notification_text, ' + username + ', ' + groupName + ']]',
|
||||
nid: 'group:' + groupName + ':uid:' + uid + ':request',
|
||||
path: '/groups/' + utils.slugify(groupName),
|
||||
from: uid
|
||||
from: uid,
|
||||
}, next);
|
||||
},
|
||||
owners: function (next) {
|
||||
Groups.getOwners(groupName, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -133,7 +133,7 @@ module.exports = function (Groups) {
|
||||
return next();
|
||||
}
|
||||
notifications.push(results.notification, results.owners, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -142,7 +142,7 @@ module.exports = function (Groups) {
|
||||
async.waterfall([
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':pending', uid),
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':invited', uid),
|
||||
async.apply(Groups.join, groupName, uid)
|
||||
async.apply(Groups.join, groupName, uid),
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -150,7 +150,7 @@ module.exports = function (Groups) {
|
||||
// Note: For simplicity, this method intentially doesn't check the caller uid for ownership!
|
||||
async.parallel([
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':pending', uid),
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':invited', uid)
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':invited', uid),
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -161,11 +161,11 @@ module.exports = function (Groups) {
|
||||
bodyShort: '[[groups:invited.notification_title, ' + groupName + ']]',
|
||||
bodyLong: '',
|
||||
nid: 'group:' + groupName + ':uid:' + uid + ':invite',
|
||||
path: '/groups/' + utils.slugify(groupName)
|
||||
path: '/groups/' + utils.slugify(groupName),
|
||||
}),
|
||||
function (notification, next) {
|
||||
notifications.push(notification, [uid], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -182,7 +182,7 @@ module.exports = function (Groups) {
|
||||
exists: async.apply(Groups.exists, groupName),
|
||||
isMember: async.apply(Groups.isMember, uid, groupName),
|
||||
isPending: async.apply(Groups.isPending, uid, groupName),
|
||||
isInvited: async.apply(Groups.isInvited, uid, groupName)
|
||||
isInvited: async.apply(Groups.isInvited, uid, groupName),
|
||||
}, next);
|
||||
},
|
||||
function (checks, next) {
|
||||
@@ -201,10 +201,10 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook(hookName, {
|
||||
groupName: groupName,
|
||||
uid: uid
|
||||
uid: uid,
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ module.exports = function (Groups) {
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetRemove, 'group:' + groupName + ':members', uid),
|
||||
async.apply(db.setRemove, 'group:' + groupName + ':owners', uid),
|
||||
async.apply(db.decrObjectField, 'group:' + groupName, 'memberCount')
|
||||
async.apply(db.decrObjectField, 'group:' + groupName, 'memberCount'),
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -253,10 +253,10 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:group.leave', {
|
||||
groupName: groupName,
|
||||
uid: uid
|
||||
uid: uid,
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -279,10 +279,10 @@ module.exports = function (Groups) {
|
||||
},
|
||||
function (next) {
|
||||
Groups.rejectMembership(groupName, uid, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -343,7 +343,7 @@ module.exports = function (Groups) {
|
||||
function (isMember, next) {
|
||||
cache.set(cacheKey, isMember);
|
||||
next(null, isMember);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -376,7 +376,7 @@ module.exports = function (Groups) {
|
||||
});
|
||||
|
||||
getFromCache(next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -413,7 +413,7 @@ module.exports = function (Groups) {
|
||||
});
|
||||
|
||||
getFromCache(next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -551,7 +551,7 @@ module.exports = function (Groups) {
|
||||
return next(new Error('[[error:group-needs-owner]]'));
|
||||
}
|
||||
Groups.leave(groupName, uid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
} else {
|
||||
Groups.leave(groupName, uid, callback);
|
||||
|
||||
@@ -32,7 +32,7 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:group.grantOwnership', {uid: toUid, groupName: groupName});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:group.rescindOwnership', {uid: toUid, groupName: groupName});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = function (Groups) {
|
||||
}
|
||||
|
||||
Groups.sort(options.sort, groupsData, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ module.exports = function (Groups) {
|
||||
}
|
||||
}
|
||||
next(null, uids);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ module.exports = function (Groups) {
|
||||
}
|
||||
});
|
||||
next(null, results);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = function (Groups) {
|
||||
}
|
||||
plugins.fireHook('filter:group.update', {
|
||||
groupName: groupName,
|
||||
values: values
|
||||
values: values,
|
||||
}, next);
|
||||
},
|
||||
function (result, next) {
|
||||
@@ -32,7 +32,7 @@ module.exports = function (Groups) {
|
||||
var payload = {
|
||||
description: values.description || '',
|
||||
icon: values.icon || '',
|
||||
labelColor: values.labelColor || '#000000'
|
||||
labelColor: values.labelColor || '#000000',
|
||||
};
|
||||
|
||||
if (values.hasOwnProperty('userTitle')) {
|
||||
@@ -71,16 +71,16 @@ module.exports = function (Groups) {
|
||||
}
|
||||
},
|
||||
async.apply(db.setObject, 'group:' + groupName, payload),
|
||||
async.apply(renameGroup, groupName, values.name)
|
||||
async.apply(renameGroup, groupName, values.name),
|
||||
], next);
|
||||
},
|
||||
function (result, next) {
|
||||
plugins.fireHook('action:group.update', {
|
||||
name: groupName,
|
||||
values: values
|
||||
values: values,
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ module.exports = function (Groups) {
|
||||
callback = callback || function () {};
|
||||
async.parallel([
|
||||
async.apply(db.setObjectField, 'group:' + groupName, 'hidden', hidden ? 1 : 0),
|
||||
async.apply(updateVisibility, groupName, hidden)
|
||||
async.apply(updateVisibility, groupName, hidden),
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -146,9 +146,9 @@ module.exports = function (Groups) {
|
||||
winston.verbose('[groups.update] Group is now public, automatically adding ' + uids.length + ' new members, who were pending prior.');
|
||||
async.series([
|
||||
async.apply(db.sortedSetAdd, 'group:' + groupName + ':members', scores, uids),
|
||||
async.apply(db.delete, 'group:' + groupName + ':pending')
|
||||
async.apply(db.delete, 'group:' + groupName + ':pending'),
|
||||
], next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -218,11 +218,11 @@ module.exports = function (Groups) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:group.rename', {
|
||||
old: oldName,
|
||||
new: newName
|
||||
new: newName,
|
||||
});
|
||||
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
});
|
||||
@@ -244,7 +244,7 @@ module.exports = function (Groups) {
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd(group, score, newName, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ image.resizeImage = function (data, callback) {
|
||||
target: data.target,
|
||||
extension: data.extension,
|
||||
width: data.width,
|
||||
height: data.height
|
||||
height: data.height,
|
||||
}, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -69,7 +69,7 @@ image.resizeImage = function (data, callback) {
|
||||
return next();
|
||||
}
|
||||
image.write(data.target || data.path, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -81,7 +81,7 @@ image.normalise = function (path, extension, callback) {
|
||||
if (plugins.hasListeners('filter:image.normalise')) {
|
||||
plugins.fireHook('filter:image.normalise', {
|
||||
path: path,
|
||||
extension: extension
|
||||
extension: extension,
|
||||
}, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
@@ -25,20 +25,20 @@ questions.main = [
|
||||
{
|
||||
name: 'secret',
|
||||
description: 'Please enter a NodeBB secret',
|
||||
'default': nconf.get('secret') || utils.generateUUID()
|
||||
'default': nconf.get('secret') || utils.generateUUID(),
|
||||
},
|
||||
{
|
||||
name: 'database',
|
||||
description: 'Which database to use',
|
||||
'default': nconf.get('database') || 'mongo'
|
||||
}
|
||||
'default': nconf.get('database') || 'mongo',
|
||||
},
|
||||
];
|
||||
|
||||
questions.optional = [
|
||||
{
|
||||
name: 'port',
|
||||
default: nconf.get('port') || 4567
|
||||
}
|
||||
default: nconf.get('port') || 4567,
|
||||
},
|
||||
];
|
||||
|
||||
function checkSetupFlag(next) {
|
||||
@@ -75,7 +75,7 @@ function checkSetupFlag(next) {
|
||||
}
|
||||
} else if (nconf.get('database')) {
|
||||
install.values = {
|
||||
database: nconf.get('database')
|
||||
database: nconf.get('database'),
|
||||
};
|
||||
next();
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ function setupConfig(next) {
|
||||
},
|
||||
function (config, next) {
|
||||
completeConfigSetup(config, next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ function completeConfigSetup(config, next) {
|
||||
},
|
||||
function (next) {
|
||||
require('./database').createIndices(next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ function enableDefaultTheme(next) {
|
||||
process.stdout.write('Enabling default theme: ' + defaultTheme + '\n');
|
||||
meta.themes.set({
|
||||
type: 'local',
|
||||
id: defaultTheme
|
||||
id: defaultTheme,
|
||||
}, next);
|
||||
});
|
||||
}
|
||||
@@ -231,25 +231,25 @@ function createAdmin(callback) {
|
||||
name: 'username',
|
||||
description: 'Administrator username',
|
||||
required: true,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
}, {
|
||||
name: 'email',
|
||||
description: 'Administrator email address',
|
||||
pattern: /.+@.+/,
|
||||
required: true
|
||||
required: true,
|
||||
}],
|
||||
passwordQuestions = [{
|
||||
name: 'password',
|
||||
description: 'Password',
|
||||
required: true,
|
||||
hidden: true,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
}, {
|
||||
name: 'password:confirm',
|
||||
description: 'Confirm Password',
|
||||
required: true,
|
||||
hidden: true,
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
}],
|
||||
success = function (err, results) {
|
||||
if (err) {
|
||||
@@ -283,7 +283,7 @@ function createAdmin(callback) {
|
||||
},
|
||||
function (next) {
|
||||
Groups.ownership.grant(adminUid, 'administrators', next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -323,7 +323,7 @@ function createAdmin(callback) {
|
||||
username: install.values['admin:username'] || nconf.get('admin:username') || 'admin',
|
||||
email: install.values['admin:email'] || nconf.get('admin:email') || '',
|
||||
password: install.values['admin:password'] || nconf.get('admin:password') || password,
|
||||
'password:confirm': install.values['admin:password:confirm'] || nconf.get('admin:password') || password
|
||||
'password:confirm': install.values['admin:password:confirm'] || nconf.get('admin:password') || password,
|
||||
};
|
||||
|
||||
success(null, results);
|
||||
@@ -347,12 +347,12 @@ function createGlobalModeratorsGroup(next) {
|
||||
description: 'Forum wide moderators',
|
||||
hidden: 0,
|
||||
private: 1,
|
||||
disableJoinRequests: 1
|
||||
disableJoinRequests: 1,
|
||||
}, next);
|
||||
},
|
||||
function (groupData, next) {
|
||||
groups.show('Global Moderators', next);
|
||||
}
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ function createWelcomePost(next) {
|
||||
},
|
||||
function (next) {
|
||||
db.getObjectField('global', 'topicCount', next);
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -421,7 +421,7 @@ function createWelcomePost(next) {
|
||||
uid: 1,
|
||||
cid: 2,
|
||||
title: 'Welcome to your NodeBB!',
|
||||
content: content.toString()
|
||||
content: content.toString(),
|
||||
}, next);
|
||||
} else {
|
||||
next();
|
||||
@@ -441,7 +441,7 @@ function enableDefaultPlugins(next) {
|
||||
'nodebb-rewards-essentials',
|
||||
'nodebb-plugin-soundpack-default',
|
||||
'nodebb-plugin-emoji-extended',
|
||||
'nodebb-plugin-emoji-one'
|
||||
'nodebb-plugin-emoji-one',
|
||||
],
|
||||
customDefaults = nconf.get('defaultPlugins');
|
||||
|
||||
@@ -478,7 +478,7 @@ function setCopyrightWidget(next) {
|
||||
},
|
||||
footer: function (next) {
|
||||
db.getObjectField('widgets:global', 'footer', next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -516,7 +516,7 @@ install.setup = function (callback) {
|
||||
if (!uptodate) { upgrade.upgrade(next); }
|
||||
else { next(); }
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err, results) {
|
||||
if (err) {
|
||||
winston.warn('NodeBB Setup Aborted.\n ' + err.stack);
|
||||
@@ -549,7 +549,7 @@ install.save = function (server_conf, callback) {
|
||||
process.stdout.write('Configuration Saved OK\n');
|
||||
|
||||
nconf.file({
|
||||
file: path.join(__dirname, '..', 'config.json')
|
||||
file: path.join(__dirname, '..', 'config.json'),
|
||||
});
|
||||
|
||||
callback();
|
||||
|
||||
@@ -24,7 +24,7 @@ var opts = {
|
||||
},
|
||||
streams : {
|
||||
log : { f : process.stdout },
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Messaging.getMessages = function (params, callback) {
|
||||
messageData.index = indices[messageData.messageId.toString()];
|
||||
});
|
||||
next(null, messageData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ function canGet(hook, callerUid, uid, callback) {
|
||||
plugins.fireHook(hook, {
|
||||
callerUid: callerUid,
|
||||
uid: uid,
|
||||
canGet: parseInt(callerUid, 10) === parseInt(uid, 10)
|
||||
canGet: parseInt(callerUid, 10) === parseInt(uid, 10),
|
||||
}, function (err, data) {
|
||||
callback(err, data ? data.canGet : false);
|
||||
});
|
||||
@@ -84,7 +84,7 @@ Messaging.parse = function (message, fromuid, uid, roomId, isNew, callback) {
|
||||
uid: uid,
|
||||
roomId: roomId,
|
||||
isNew: isNew,
|
||||
parsedMessage: parsed
|
||||
parsedMessage: parsed,
|
||||
};
|
||||
|
||||
plugins.fireHook('filter:messaging.parse', messageData, function (err, messageData) {
|
||||
@@ -106,7 +106,7 @@ Messaging.isNewSet = function (uid, roomId, timestamp, callback) {
|
||||
} else {
|
||||
next(null, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -147,7 +147,7 @@ Messaging.getRecentChats = function (callerUid, uid, start, stop, callback) {
|
||||
async.map(roomIds, function (roomId, next) {
|
||||
Messaging.getTeaser(uid, roomId, next);
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -171,7 +171,7 @@ Messaging.getRecentChats = function (callerUid, uid, start, stop, callback) {
|
||||
});
|
||||
|
||||
next(null, {rooms: results.roomData, nextStart: stop + 1});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ Messaging.getTeaser = function (uid, roomId, callback) {
|
||||
plugins.fireHook('filter:messaging.getTeaser', { teaser: teaser }, function (err, data) {
|
||||
next(err, data.teaser);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -248,7 +248,7 @@ Messaging.canMessageUser = function (uid, toUid, callback) {
|
||||
async.parallel({
|
||||
settings: async.apply(user.getSettings, toUid),
|
||||
isAdmin: async.apply(user.isAdministrator, uid),
|
||||
isFollowing: async.apply(user.isFollowing, toUid, uid)
|
||||
isFollowing: async.apply(user.isFollowing, toUid, uid),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -257,7 +257,7 @@ Messaging.canMessageUser = function (uid, toUid, callback) {
|
||||
}
|
||||
|
||||
next(new Error('[[error:chat-restricted]]'));
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -294,7 +294,7 @@ Messaging.canMessageRoom = function (uid, roomId, callback) {
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -306,7 +306,7 @@ Messaging.hasPrivateChat = function (uid, withUid, callback) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
myRooms: async.apply(db.getSortedSetRevRange, 'uid:' + uid + ':chat:rooms', 0, -1),
|
||||
theirRooms: async.apply(db.getSortedSetRevRange, 'uid:' + withUid + ':chat:rooms', 0, -1)
|
||||
theirRooms: async.apply(db.getSortedSetRevRange, 'uid:' + withUid + ':chat:rooms', 0, -1),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -338,6 +338,6 @@ Messaging.hasPrivateChat = function (uid, withUid, callback) {
|
||||
}, function (err) {
|
||||
next(err, roomId);
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = function (Messaging) {
|
||||
}
|
||||
|
||||
Messaging.addMessage(uid, roomId, content, timestamp, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ module.exports = function (Messaging) {
|
||||
content: content,
|
||||
timestamp: timestamp,
|
||||
fromuid: fromuid,
|
||||
roomId: roomId
|
||||
roomId: roomId,
|
||||
};
|
||||
|
||||
plugins.fireHook('filter:messaging.save', message, next);
|
||||
@@ -76,13 +76,13 @@ module.exports = function (Messaging) {
|
||||
async.apply(Messaging.addRoomToUsers, roomId, uids, timestamp),
|
||||
async.apply(Messaging.addMessageToUsers, roomId, uids, mid, timestamp),
|
||||
async.apply(Messaging.markUnread, uids, roomId),
|
||||
async.apply(Messaging.addUsersToRoom, fromuid, [fromuid], roomId)
|
||||
async.apply(Messaging.addUsersToRoom, fromuid, [fromuid], roomId),
|
||||
], next);
|
||||
},
|
||||
function (results, next) {
|
||||
async.parallel({
|
||||
markRead: async.apply(Messaging.markRead, fromuid, roomId),
|
||||
messages: async.apply(Messaging.getMessagesData, [mid], fromuid, roomId, true)
|
||||
messages: async.apply(Messaging.getMessagesData, [mid], fromuid, roomId, true),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -94,7 +94,7 @@ module.exports = function (Messaging) {
|
||||
results.messages[0].mid = mid;
|
||||
results.messages[0].roomId = roomId;
|
||||
next(null, results.messages[0]);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (mid, next) {
|
||||
Messaging.getMessageFields(mid, ['fromuid', 'timestamp'], next);
|
||||
}
|
||||
},
|
||||
], function (err, fields) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -129,7 +129,7 @@ module.exports = function (Messaging) {
|
||||
} else {
|
||||
next(null, []);
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (next) {
|
||||
db.delete('message:' + mid, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
@@ -23,7 +23,7 @@ module.exports = function (Messaging) {
|
||||
|
||||
Messaging.setMessageFields(mid, {
|
||||
content: content,
|
||||
edited: Date.now()
|
||||
edited: Date.now(),
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
@@ -36,11 +36,11 @@ module.exports = function (Messaging) {
|
||||
function (messages, next) {
|
||||
uids.forEach(function (uid) {
|
||||
sockets.in('uid_' + uid).emit('event:chats.edit', {
|
||||
messages: messages
|
||||
messages: messages,
|
||||
});
|
||||
});
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (isAdmin, next) {
|
||||
next(null, isAdmin);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = function (Messaging) {
|
||||
var data = {
|
||||
roomId: roomId,
|
||||
fromUid: fromUid,
|
||||
message: messageObj
|
||||
message: messageObj,
|
||||
};
|
||||
uids.forEach(function (uid) {
|
||||
data.self = parseInt(uid, 10) === parseInt(fromUid) ? 1 : 0;
|
||||
@@ -38,7 +38,7 @@ module.exports = function (Messaging) {
|
||||
clearTimeout(queueObj.timeout);
|
||||
} else {
|
||||
queueObj = Messaging.notifyQueue[fromUid + ':' + roomId] = {
|
||||
message: messageObj
|
||||
message: messageObj,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ module.exports = function (Messaging) {
|
||||
bodyLong: messageObj.content,
|
||||
nid: 'chat_' + fromuid + '_' + roomId,
|
||||
from: fromuid,
|
||||
path: '/chats/' + messageObj.roomId
|
||||
path: '/chats/' + messageObj.roomId,
|
||||
}, function (err, notification) {
|
||||
if (!err && notification) {
|
||||
notifications.push(notification, uids, callback);
|
||||
@@ -93,7 +93,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
userSettings: function (next) {
|
||||
user.getMultipleUserSettings(uids, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return winston.error(err);
|
||||
@@ -112,7 +112,7 @@ module.exports = function (Messaging) {
|
||||
url: nconf.get('url'),
|
||||
roomId: messageObj.roomId,
|
||||
username: userData.username,
|
||||
userslug: userData.userslug
|
||||
userslug: userData.userslug,
|
||||
}, next);
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
|
||||
@@ -55,7 +55,7 @@ module.exports = function (Messaging) {
|
||||
roomId = _roomId;
|
||||
var room = {
|
||||
owner: uid,
|
||||
roomId: roomId
|
||||
roomId: roomId,
|
||||
};
|
||||
db.setObject('chat:room:' + roomId, room, next);
|
||||
},
|
||||
@@ -70,7 +70,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (next) {
|
||||
next(null, roomId);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (data, next) {
|
||||
next(null, data.inRoom);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ module.exports = function (Messaging) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
userCount: async.apply(db.sortedSetCard, 'chat:room:' + roomId + ':uids'),
|
||||
roomData: async.apply(db.getObject, 'chat:room:' + roomId)
|
||||
roomData: async.apply(db.getObject, 'chat:room:' + roomId),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -132,7 +132,7 @@ module.exports = function (Messaging) {
|
||||
return db.setObjectField('chat:room:' + roomId, 'groupChat', 1, next);
|
||||
}
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -141,7 +141,7 @@ module.exports = function (Messaging) {
|
||||
function (next) {
|
||||
async.parallel({
|
||||
isOwner: async.apply(Messaging.isRoomOwner, uid, roomId),
|
||||
userCount: async.apply(Messaging.getUserCountInRoom, roomId)
|
||||
userCount: async.apply(Messaging.getUserCountInRoom, roomId),
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -152,7 +152,7 @@ module.exports = function (Messaging) {
|
||||
return next(new Error('[[error:cant-remove-last-user]]'));
|
||||
}
|
||||
Messaging.leaveRoom(uids, roomId, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -169,7 +169,7 @@ module.exports = function (Messaging) {
|
||||
return 'uid:' + uid + ':chat:rooms:unread';
|
||||
}));
|
||||
db.sortedSetsRemove(keys, roomId, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -184,7 +184,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (uids, next) {
|
||||
user.getUsersFields(uids, ['uid', 'username', 'picture', 'status'], next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -205,7 +205,7 @@ module.exports = function (Messaging) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
db.setObjectField('chat:room:' + roomId, 'roomName', newName, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -219,7 +219,7 @@ module.exports = function (Messaging) {
|
||||
},
|
||||
function (data, next) {
|
||||
next(null, data.canReply);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ module.exports = function (Messaging) {
|
||||
});
|
||||
|
||||
db.sortedSetsAdd(keys, Date.now(), roomId, next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ var utils = require('../public/src/utils');
|
||||
slug = utils.slugify(slug);
|
||||
async.parallel([
|
||||
async.apply(user.existsBySlug, slug),
|
||||
async.apply(groups.existsBySlug, slug)
|
||||
async.apply(groups.existsBySlug, slug),
|
||||
], function (err, results) {
|
||||
callback(err, results ? results.some(function (result) { return result; }) : false);
|
||||
});
|
||||
@@ -62,7 +62,7 @@ var utils = require('../public/src/utils');
|
||||
function restart() {
|
||||
if (process.send) {
|
||||
process.send({
|
||||
action: 'restart'
|
||||
action: 'restart',
|
||||
});
|
||||
} else {
|
||||
winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?');
|
||||
|
||||
@@ -6,13 +6,13 @@ var async = require('async');
|
||||
var db = require('../database');
|
||||
|
||||
var Blacklist = {
|
||||
_rules: []
|
||||
_rules: [],
|
||||
};
|
||||
|
||||
Blacklist.load = function (callback) {
|
||||
async.waterfall([
|
||||
async.apply(db.get, 'ip-blacklist-rules'),
|
||||
async.apply(Blacklist.validate)
|
||||
async.apply(Blacklist.validate),
|
||||
], function (err, rules) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -26,7 +26,7 @@ Blacklist.load = function (callback) {
|
||||
Blacklist._rules = {
|
||||
ipv4: rules.ipv4,
|
||||
ipv6: rules.ipv6,
|
||||
cidr: rules.cidr
|
||||
cidr: rules.cidr,
|
||||
};
|
||||
|
||||
callback();
|
||||
@@ -119,7 +119,7 @@ Blacklist.validate = function (rules, callback) {
|
||||
ipv6: ipv6,
|
||||
cidr: cidr,
|
||||
valid: rules,
|
||||
invalid: invalid
|
||||
invalid: invalid,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ exports.build = function build(targets, callback) {
|
||||
async.series([
|
||||
async.apply(db.init),
|
||||
async.apply(meta.themes.setupPaths),
|
||||
async.apply(plugins.prepareForBuild)
|
||||
async.apply(plugins.prepareForBuild),
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('[build] Encountered error preparing for build: ' + err.message);
|
||||
@@ -74,7 +74,7 @@ exports.buildTargets = function (targets, callback) {
|
||||
meta.js.linkModules,
|
||||
meta.js.linkStatics,
|
||||
async.apply(meta.js.minify, 'nodebb.min.js'),
|
||||
async.apply(meta.js.minify, 'acp.min.js')
|
||||
async.apply(meta.js.minify, 'acp.min.js'),
|
||||
], step.bind(this, startTime, 'js', next));
|
||||
} else {
|
||||
setImmediate(next);
|
||||
@@ -117,7 +117,7 @@ exports.buildTargets = function (targets, callback) {
|
||||
break;
|
||||
}
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('[build] Encountered error during build step: ' + err.message);
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = function (Meta) {
|
||||
Meta.config = config;
|
||||
next();
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ module.exports = function (Meta) {
|
||||
function (next) {
|
||||
updateConfig(data);
|
||||
setImmediate(next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -91,13 +91,13 @@ module.exports = function (Meta) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
less.render(data.customCSS, {
|
||||
compress: true
|
||||
compress: true,
|
||||
}, next);
|
||||
},
|
||||
function (lessObject, next) {
|
||||
data.renderedCustomCSS = lessObject.css;
|
||||
setImmediate(next);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ module.exports = function (Meta) {
|
||||
} else {
|
||||
setImmediate(next);
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ module.exports = function (Meta) {
|
||||
var paths = [
|
||||
baseThemePath,
|
||||
path.join(__dirname, '../../node_modules'),
|
||||
path.join(__dirname, '../../public/vendor/fontawesome/less')
|
||||
path.join(__dirname, '../../public/vendor/fontawesome/less'),
|
||||
];
|
||||
var source = '';
|
||||
|
||||
@@ -78,7 +78,7 @@ module.exports = function (Meta) {
|
||||
function (src, next) {
|
||||
source += src;
|
||||
next();
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -136,7 +136,7 @@ module.exports = function (Meta) {
|
||||
function minify(source, paths, target, callback) {
|
||||
callback = callback || function () {};
|
||||
less.render(source, {
|
||||
paths: paths
|
||||
paths: paths,
|
||||
}, function (err, lessOutput) {
|
||||
if (err) {
|
||||
winston.error('[meta/css] Could not minify LESS/CSS: ' + err.message);
|
||||
@@ -146,7 +146,7 @@ module.exports = function (Meta) {
|
||||
postcss(global.env === 'development' ? [ autoprefixer ] : [
|
||||
autoprefixer,
|
||||
clean({
|
||||
processImportFrom: ['local']
|
||||
processImportFrom: ['local'],
|
||||
}),
|
||||
]).process(lessOutput.css).then(function (result) {
|
||||
result.warnings().forEach(function (warn) {
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = function (Meta) {
|
||||
|
||||
async.every(modules, function (module, next) {
|
||||
fs.readFile(path.join(__dirname, '../../node_modules/', module, 'package.json'), {
|
||||
encoding: 'utf-8'
|
||||
encoding: 'utf-8',
|
||||
}, function (err, pkgData) {
|
||||
// If a bundled plugin/theme is not present, skip the dep check (#3384)
|
||||
if (err && err.code === 'ENOENT' && (module === 'nodebb-rewards-essentials' || module.startsWith('nodebb-plugin') || module.startsWith('nodebb-theme'))) {
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = function (Meta) {
|
||||
'public/src/ajaxify.js',
|
||||
'public/src/overrides.js',
|
||||
'public/src/widgets.js',
|
||||
"./node_modules/promise-polyfill/promise.js"
|
||||
"./node_modules/promise-polyfill/promise.js",
|
||||
],
|
||||
|
||||
// files listed below are only available client-side, or are bundled in to reduce # of network requests on cold load
|
||||
@@ -76,7 +76,7 @@ module.exports = function (Meta) {
|
||||
'public/src/modules/taskbar.js',
|
||||
'public/src/modules/helpers.js',
|
||||
'public/src/modules/sounds.js',
|
||||
'public/src/modules/string.js'
|
||||
'public/src/modules/string.js',
|
||||
],
|
||||
|
||||
// modules listed below are routed through express (/src/modules) so they can be defined anonymously
|
||||
@@ -85,9 +85,9 @@ module.exports = function (Meta) {
|
||||
"mousetrap.js": './node_modules/mousetrap/mousetrap.min.js',
|
||||
"jqueryui.js": 'public/vendor/jquery/js/jquery-ui.js',
|
||||
"buzz.js": 'public/vendor/buzz/buzz.js',
|
||||
"cropper.js": './node_modules/cropperjs/dist/cropper.min.js'
|
||||
}
|
||||
}
|
||||
"cropper.js": './node_modules/cropperjs/dist/cropper.min.js',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Meta.js.linkModules = function (callback) {
|
||||
@@ -145,7 +145,7 @@ module.exports = function (Meta) {
|
||||
minifier.send({
|
||||
action: 'js',
|
||||
minify: global.env !== 'development',
|
||||
scripts: Meta.js.target[target].scripts
|
||||
scripts: Meta.js.target[target].scripts,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ var winston = require('winston');
|
||||
|
||||
module.exports = function (Meta) {
|
||||
Meta.logs = {
|
||||
path: path.join(nconf.get('base_dir'), 'logs', 'output.log')
|
||||
path: path.join(nconf.get('base_dir'), 'logs', 'output.log'),
|
||||
};
|
||||
|
||||
Meta.logs.get = function (callback) {
|
||||
fs.readFile(Meta.logs.path, {
|
||||
encoding: 'utf-8'
|
||||
encoding: 'utf-8',
|
||||
}, function (err, logs) {
|
||||
if (err) {
|
||||
winston.error('[meta/logs] Could not retrieve logs: ' + err.message);
|
||||
|
||||
@@ -27,12 +27,12 @@ module.exports = function (Meta) {
|
||||
function (next) {
|
||||
plugins.fireHook('action:settings.set', {
|
||||
plugin: hash,
|
||||
settings: values
|
||||
settings: values,
|
||||
});
|
||||
|
||||
Meta.reloadRequired = true;
|
||||
next();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ module.exports = function (Meta) {
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
@@ -41,7 +41,7 @@ module.exports = function (Meta) {
|
||||
}
|
||||
next(null, sounds.concat(uploaded));
|
||||
});
|
||||
}
|
||||
},
|
||||
], function (err, files) {
|
||||
if (err) {
|
||||
winston.error('Could not get local sound files:' + err.message);
|
||||
@@ -73,7 +73,7 @@ module.exports = function (Meta) {
|
||||
},
|
||||
userSettings: function (next) {
|
||||
user.getSettings(uid, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -130,7 +130,7 @@ module.exports = function (Meta) {
|
||||
},
|
||||
function (next) {
|
||||
mkdirp(soundsPath, next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
winston.error('Could not initialise sound files:' + err.message);
|
||||
@@ -153,7 +153,7 @@ module.exports = function (Meta) {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
};
|
||||
@@ -14,30 +14,30 @@ module.exports = function (Meta) {
|
||||
tags: function (next) {
|
||||
var defaultTags = [{
|
||||
name: 'viewport',
|
||||
content: 'width=device-width, initial-scale=1.0'
|
||||
content: 'width=device-width, initial-scale=1.0',
|
||||
}, {
|
||||
name: 'content-type',
|
||||
content: 'text/html; charset=UTF-8',
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
}, {
|
||||
name: 'apple-mobile-web-app-capable',
|
||||
content: 'yes'
|
||||
content: 'yes',
|
||||
}, {
|
||||
name: 'mobile-web-app-capable',
|
||||
content: 'yes'
|
||||
content: 'yes',
|
||||
}, {
|
||||
property: 'og:site_name',
|
||||
content: Meta.config.title || 'NodeBB'
|
||||
content: Meta.config.title || 'NodeBB',
|
||||
}, {
|
||||
name: 'msapplication-badge',
|
||||
content: 'frequency=30; polling-uri=' + nconf.get('url') + '/sitemap.xml',
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
}];
|
||||
|
||||
if (Meta.config.keywords) {
|
||||
defaultTags.push({
|
||||
name: 'keywords',
|
||||
content: Meta.config.keywords
|
||||
content: Meta.config.keywords,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = function (Meta) {
|
||||
defaultTags.push({
|
||||
name: 'msapplication-square150x150logo',
|
||||
content: Meta.config['brand:logo'],
|
||||
noEscape: true
|
||||
noEscape: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,45 +55,45 @@ module.exports = function (Meta) {
|
||||
var defaultLinks = [{
|
||||
rel: "icon",
|
||||
type: "image/x-icon",
|
||||
href: nconf.get('relative_path') + '/favicon.ico' + (Meta.config['cache-buster'] ? '?' + Meta.config['cache-buster'] : '')
|
||||
href: nconf.get('relative_path') + '/favicon.ico' + (Meta.config['cache-buster'] ? '?' + Meta.config['cache-buster'] : ''),
|
||||
}, {
|
||||
rel: "manifest",
|
||||
href: nconf.get('relative_path') + '/manifest.json'
|
||||
href: nconf.get('relative_path') + '/manifest.json',
|
||||
}];
|
||||
|
||||
// Touch icons for mobile-devices
|
||||
if (Meta.config['brand:touchIcon']) {
|
||||
defaultLinks.push({
|
||||
rel: 'apple-touch-icon',
|
||||
href: nconf.get('relative_path') + '/apple-touch-icon'
|
||||
href: nconf.get('relative_path') + '/apple-touch-icon',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '36x36',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-36.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-36.png',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '48x48',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-48.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-48.png',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '72x72',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-72.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-72.png',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '96x96',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-96.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-96.png',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '144x144',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-144.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-144.png',
|
||||
}, {
|
||||
rel: 'icon',
|
||||
sizes: '192x192',
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-192.png'
|
||||
href: nconf.get('relative_path') + '/assets/uploads/system/touchicon-192.png',
|
||||
});
|
||||
}
|
||||
plugins.fireHook('filter:meta.getLinkTags', defaultLinks, next);
|
||||
}
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -118,7 +118,7 @@ module.exports = function (Meta) {
|
||||
|
||||
callback(null, {
|
||||
meta: meta,
|
||||
link: link
|
||||
link: link,
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -134,7 +134,7 @@ module.exports = function (Meta) {
|
||||
if (!hasDescription) {
|
||||
meta.push({
|
||||
name: 'description',
|
||||
content: validator.escape(String(Meta.config.description || ''))
|
||||
content: validator.escape(String(Meta.config.description || '')),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ function preparePaths(baseTemplatesPaths, callback) {
|
||||
},
|
||||
function (next) {
|
||||
plugins.getTemplates(next);
|
||||
}
|
||||
},
|
||||
], function (err, pluginTemplates) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -69,14 +69,14 @@ function preparePaths(baseTemplatesPaths, callback) {
|
||||
paths = paths.map(function (tpl) {
|
||||
return {
|
||||
base: baseTemplatePath,
|
||||
path: tpl.replace(baseTemplatePath, '')
|
||||
path: tpl.replace(baseTemplatePath, ''),
|
||||
};
|
||||
});
|
||||
|
||||
next(err, paths);
|
||||
});
|
||||
}, next);
|
||||
}
|
||||
},
|
||||
}, function (err, data) {
|
||||
var baseThemes = data.baseThemes,
|
||||
coreTpls = data.coreTpls,
|
||||
|
||||
@@ -75,7 +75,7 @@ module.exports = function (Meta) {
|
||||
'theme:id': data.id,
|
||||
'theme:staticDir': '',
|
||||
'theme:templates': '',
|
||||
'theme:src': ''
|
||||
'theme:src': '',
|
||||
};
|
||||
|
||||
switch(data.type) {
|
||||
@@ -85,7 +85,7 @@ module.exports = function (Meta) {
|
||||
function (current, next) {
|
||||
async.series([
|
||||
async.apply(db.sortedSetRemove, 'plugins:active', current),
|
||||
async.apply(db.sortedSetAdd, 'plugins:active', 0, data.id)
|
||||
async.apply(db.sortedSetAdd, 'plugins:active', 0, data.id),
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
@@ -109,7 +109,7 @@ module.exports = function (Meta) {
|
||||
|
||||
// Re-set the themes path (for when NodeBB is reloaded)
|
||||
Meta.themes.setPath(config);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
|
||||
Meta.reloadRequired = true;
|
||||
@@ -126,7 +126,7 @@ module.exports = function (Meta) {
|
||||
themesData: Meta.themes.get,
|
||||
currentThemeId: function (next) {
|
||||
db.getObjectField('config', 'theme:id', next);
|
||||
}
|
||||
},
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user