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' 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) ->