From b12811d21dd2b07bbe4d028ccecab53e5382cdc8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 4 May 2016 10:08:56 -0400 Subject: [PATCH] spring cleaning --- src/controllers/authentication.js | 2 - src/plugins/hooks.js | 4 +- src/upgrade.js | 84 +------------------------------ src/user/delete.js | 4 -- 4 files changed, 2 insertions(+), 92 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 0912d99ac9..bc2369bd62 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -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(''); }); diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index 3330608154..aad5466005 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -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 }; /* diff --git a/src/upgrade.js b/src/upgrade.js index 87d2dc7c78..1874db129e 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -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); diff --git a/src/user/delete.js b/src/user/delete.js index 3ab5176725..011ed0aa12 100644 --- a/src/user/delete.js +++ b/src/user/delete.js @@ -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); },