From dc24c42f5444b6c583770c2fdf407cb7c54b18f5 Mon Sep 17 00:00:00 2001 From: Aniruddh Agarwal Date: Fri, 15 Apr 2016 21:38:03 +0800 Subject: [PATCH 1/2] Unsub from all FCC emails regardless of unsub link --- server/boot/randomAPIs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/boot/randomAPIs.js b/server/boot/randomAPIs.js index 3fd3f953bd..5d8a0e994a 100644 --- a/server/boot/randomAPIs.js +++ b/server/boot/randomAPIs.js @@ -177,7 +177,11 @@ module.exports = function(app) { }); return res.redirect('/map'); } - return user.updateAttribute('sendMonthlyEmail', false, (err) => { + return user.updateAttributes({ + 'sendMonthlyEmail': false, + 'sendQuincyEmail': false, + 'sendNotificationEmail': false + }, (err) => { if (err) { return next(err); } req.flash('info', { msg: 'We\'ve successfully updated your Email preferences.' @@ -219,7 +223,11 @@ module.exports = function(app) { }); return res.redirect('/map'); } - return user.updateAttribute('sendQuincyEmail', false, (err) => { + return user.updateAttributes({ + 'sendQuincyEmail': false, + 'sendMonthlyEmail': false, + 'sendNotificationEmail': false + }, (err) => { if (err) { return next(err); } req.flash('info', { msg: 'We\'ve successfully updated your Email preferences.' From 33faa3bada8084b38cb12f204abf240f7be0bea1 Mon Sep 17 00:00:00 2001 From: Aniruddh Agarwal Date: Fri, 15 Apr 2016 23:06:03 +0800 Subject: [PATCH 2/2] Remove quotes from object keys --- server/boot/randomAPIs.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/boot/randomAPIs.js b/server/boot/randomAPIs.js index 5d8a0e994a..8de1503c69 100644 --- a/server/boot/randomAPIs.js +++ b/server/boot/randomAPIs.js @@ -178,9 +178,9 @@ module.exports = function(app) { return res.redirect('/map'); } return user.updateAttributes({ - 'sendMonthlyEmail': false, - 'sendQuincyEmail': false, - 'sendNotificationEmail': false + sendMonthlyEmail: false, + sendQuincyEmail: false, + sendNotificationEmail: false }, (err) => { if (err) { return next(err); } req.flash('info', { @@ -224,9 +224,9 @@ module.exports = function(app) { return res.redirect('/map'); } return user.updateAttributes({ - 'sendQuincyEmail': false, - 'sendMonthlyEmail': false, - 'sendNotificationEmail': false + sendQuincyEmail: false, + sendMonthlyEmail: false, + sendNotificationEmail: false }, (err) => { if (err) { return next(err); } req.flash('info', {