mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
spring cleaning
This commit is contained in:
@@ -310,8 +310,6 @@ authenticationController.logout = function(req, res, next) {
|
||||
|
||||
user.setUserField(uid, 'lastonline', Date.now() - 300000);
|
||||
|
||||
// action:user.loggedOut deprecated in > v0.9.3
|
||||
plugins.fireHook('action:user.loggedOut', {req: req, res: res, uid: uid});
|
||||
plugins.fireHook('static:user.loggedOut', {req: req, res: res, uid: uid}, function() {
|
||||
res.status(200).send('');
|
||||
});
|
||||
|
||||
@@ -5,9 +5,7 @@ var winston = require('winston'),
|
||||
|
||||
module.exports = function(Plugins) {
|
||||
Plugins.deprecatedHooks = {
|
||||
'filter:user.delete': 'static:user.delete',
|
||||
'filter:user.custom_fields': null,
|
||||
'action:user.loggedOut': 'static:user.loggedOut'
|
||||
'filter:user.custom_fields': null // remove in v1.1.0
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@ var db = require('./database'),
|
||||
|
||||
Upgrade = {},
|
||||
|
||||
minSchemaDate = Date.UTC(2015, 7, 18), // This value gets updated every new MINOR version
|
||||
minSchemaDate = Date.UTC(2015, 10, 6), // This value gets updated every new MAJOR version
|
||||
schemaDate, thisSchemaDate,
|
||||
|
||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
||||
@@ -62,88 +62,6 @@ Upgrade.upgrade = function(callback) {
|
||||
}
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
thisSchemaDate = Date.UTC(2015, 8, 30);
|
||||
if (schemaDate < thisSchemaDate) {
|
||||
updatesMade = true;
|
||||
winston.info('[2015/09/30] Converting default Gravatar image to default User Avatar');
|
||||
|
||||
async.waterfall([
|
||||
async.apply(db.isObjectField, 'config', 'customGravatarDefaultImage'),
|
||||
function(keyExists, _next) {
|
||||
if (keyExists) {
|
||||
_next();
|
||||
} else {
|
||||
winston.info('[2015/09/30] Converting default Gravatar image to default User Avatar skipped');
|
||||
Upgrade.update(thisSchemaDate, next);
|
||||
next();
|
||||
}
|
||||
},
|
||||
async.apply(db.getObjectField, 'config', 'customGravatarDefaultImage'),
|
||||
async.apply(db.setObjectField, 'config', 'defaultAvatar'),
|
||||
async.apply(db.deleteObjectField, 'config', 'customGravatarDefaultImage')
|
||||
], function(err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
winston.info('[2015/09/30] Converting default Gravatar image to default User Avatar done');
|
||||
Upgrade.update(thisSchemaDate, next);
|
||||
});
|
||||
} else {
|
||||
winston.info('[2015/09/30] Converting default Gravatar image to default User Avatar skipped');
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
thisSchemaDate = Date.UTC(2015, 10, 6);
|
||||
if (schemaDate < thisSchemaDate) {
|
||||
updatesMade = true;
|
||||
winston.info('[2015/11/06] Removing gravatar');
|
||||
|
||||
db.getSortedSetRange('users:joindate', 0, -1, function(err, uids) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
async.eachLimit(uids, 500, function(uid, next) {
|
||||
db.getObjectFields('user:' + uid, ['picture', 'gravatarpicture'], function(err, userData) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
if (!userData.picture || !userData.gravatarpicture) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (userData.gravatarpicture === userData.picture) {
|
||||
async.series([
|
||||
function (next) {
|
||||
db.setObjectField('user:' + uid, 'picture', '', next);
|
||||
},
|
||||
function (next) {
|
||||
db.deleteObjectField('user:' + uid, 'gravatarpicture', next);
|
||||
}
|
||||
], next);
|
||||
} else {
|
||||
db.deleteObjectField('user:' + uid, 'gravatarpicture', next);
|
||||
}
|
||||
});
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
winston.info('[2015/11/06] Gravatar pictures removed!');
|
||||
Upgrade.update(thisSchemaDate, next);
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
winston.info('[2015/11/06] Gravatar removal skipped');
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next) {
|
||||
thisSchemaDate = Date.UTC(2015, 11, 15);
|
||||
|
||||
|
||||
@@ -121,10 +121,6 @@ module.exports = function(User) {
|
||||
},
|
||||
function(next) {
|
||||
groups.leaveAllGroups(uid, next);
|
||||
},
|
||||
function(next) {
|
||||
// Deprecated as of v0.7.4, remove in v1.0.0
|
||||
plugins.fireHook('filter:user.delete', uid, next);
|
||||
}
|
||||
], next);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user