Merge branch 'master' into production

This commit is contained in:
Matt Lott 2016-07-19 09:29:11 -07:00
commit f43012c7a6
3 changed files with 5 additions and 5 deletions

View file

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

View file

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

View file

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