Fix for announcement duplicates.

This commit is contained in:
Nick Winter 2014-01-06 10:33:52 -08:00
parent b8d65bab44
commit 316b382d81
2 changed files with 3 additions and 2 deletions

View file

@ -40,7 +40,7 @@ block content
li Artisans - Sootn, Aftermath, mcdavid1991
li Scribes - Ryan Faidley
li Adventurers - Kieizroe, (...)
li Archmages - David Golds, Zach Martin, Tom Steinbrecher, Mischa Lewis-Norelle, Sébastien Moratinos
li Archmages - David Golds, Zach Martin, Tom Steinbrecher, Mischa Lewis-Norelle, Sébastien Moratinos, Chloe Fan
div#contribute-main
div#intro

View file

@ -47,8 +47,9 @@ module.exports = class SignupModalView extends View
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume", "emailSubscriptions"]
userObject[key] ?= val
subscribe = @$el.find('#signup-subscribe').prop('checked')
userObject.emailSubscriptions ?= []
if subscribe
(userObject.emailSubscriptions ?= []).push 'announcement'
userObject.emailSubscriptions.push 'announcement' unless 'announcement' in userObject.emailSubscriptions
else
userObject.emailSubscriptions = _.without (userObject.emailSubscriptions ? []), 'announcement'
res = tv4.validateMultiple userObject, User.schema.attributes