From 1f1132ecf8ed203075e26fe4cd1247e48626ff61 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Mon, 18 Jul 2016 12:38:26 -0700 Subject: [PATCH 1/2] Prioritize displaying first/last names over username --- app/models/User.coffee | 4 ++-- server/models/User.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/User.coffee b/app/models/User.coffee index 30a5a11c8..fcc38e448 100644 --- a/app/models/User.coffee +++ b/app/models/User.coffee @@ -19,10 +19,10 @@ module.exports = class User extends CocoModel displayName: -> @get('name', true) broadName: -> return '(deleted)' if @get('deleted') - name = @get('name') - return name if name name = _.filter([@get('firstName'), @get('lastName')]).join(' ') return name if name + name = @get('name') + return name if name [emailName, emailDomain] = @get('email')?.split('@') or [] return emailName if emailName return 'Anonymous' diff --git a/server/models/User.coffee b/server/models/User.coffee index 8d9219777..c26edbafa 100644 --- a/server/models/User.coffee +++ b/server/models/User.coffee @@ -44,10 +44,10 @@ UserSchema.post('init', -> UserSchema.methods.broadName = -> return '(deleted)' if @get('deleted') - name = @get('name') - return name if name name = _.filter([@get('firstName'), @get('lastName')]).join(' ') return name if name + name = @get('name') + return name if name [emailName, emailDomain] = @get('email').split('@') return emailName if emailName return 'Anonymous' From 7bf3fc6a78be92196f4a6ae7e836d8fb1d60525f Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Tue, 19 Jul 2016 06:36:11 -0700 Subject: [PATCH 2/2] :bug:Don't route level load error mails to sales --- server/routes/contact.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routes/contact.coffee b/server/routes/contact.coffee index 8cbf51dbe..5a2090585 100644 --- a/server/routes/contact.coffee +++ b/server/routes/contact.coffee @@ -14,7 +14,7 @@ module.exports.setup = (app) -> # log.info "Sending mail from #{req.body.email} saying #{req.body.message}" fromAddress = req.body.sender or req.body.email or req.user.get('email') createMailContent req, fromAddress, (subject, content) -> - if req.body.licensesNeeded or req.user.isTeacher() + if (req.body.licensesNeeded or req.user.isTeacher()) and subject.indexOf('Level Load Error:') < 0 closeIO.getSalesContactEmail fromAddress, (err, salesContactEmail, userID, leadID) -> return log.error("Error getting sales contact for #{fromAddress}: #{err.message or err}") if err closeIO.sendMail fromAddress, subject, content, salesContactEmail, leadID, (err) ->