This commit is contained in:
Barış Soner Uşaklı
2018-01-31 15:20:17 -05:00
parent b2cb3def98
commit ac1f7eefe5
23 changed files with 106 additions and 44 deletions

View File

@@ -59,12 +59,12 @@ middleware.pageView = function (req, res, next) {
plugins.fireHook('action:middleware.pageView', { req: req });
if (req.user) {
user.updateLastOnlineTime(req.user.uid);
if (req.loggedIn) {
user.updateLastOnlineTime(req.uid);
if (req.path.startsWith('/api/users') || req.path.startsWith('/users')) {
user.updateOnlineUsers(req.user.uid, next);
user.updateOnlineUsers(req.uid, next);
} else {
user.updateOnlineUsers(req.user.uid);
user.updateOnlineUsers(req.uid);
next();
}
} else {
@@ -112,7 +112,7 @@ middleware.routeTouchIcon = function (req, res) {
};
middleware.privateTagListing = function (req, res, next) {
if (!req.user && parseInt(meta.config.privateTagListing, 10) === 1) {
if (!req.loggedIn && parseInt(meta.config.privateTagListing, 10) === 1) {
controllers.helpers.notAllowed(req, res);
} else {
next();
@@ -143,7 +143,7 @@ function expose(exposedField, method, field, req, res, next) {
}
middleware.privateUploads = function (req, res, next) {
if (req.user || parseInt(meta.config.privateUploads, 10) !== 1) {
if (req.loggedIn || parseInt(meta.config.privateUploads, 10) !== 1) {
return next();
}
if (req.path.startsWith(nconf.get('relative_path') + '/assets/uploads/files')) {