mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
🐛Fix license inquiry contact lookup boolean
This commit is contained in:
parent
dd66a8c252
commit
00221e6c91
1 changed files with 6 additions and 4 deletions
|
@ -3,6 +3,7 @@ log = require 'winston'
|
|||
request = require 'request'
|
||||
|
||||
apiKey = config.closeIO?.apiKey
|
||||
defaultSalesContactUser = 'user_Fh0uLUkRIKMk2to61ISq8PneyQonuD2i7hes6RhZgDX'
|
||||
|
||||
module.exports =
|
||||
logError: (msg) ->
|
||||
|
@ -65,19 +66,18 @@ module.exports =
|
|||
activities = JSON.parse(body)
|
||||
return done("Unexpected activities format: " + body) unless activities.data?
|
||||
for activity in activities.data when activity._type is 'Email'
|
||||
if /@codecombat\.(?:com)|(?:nl)/ig.test(activity.sender) and not activity.sender?.indexOf(config.mail.username) >= 0 and not activity.sender?.indexOf('brian@codecombat.com') >= 0
|
||||
if /@codecombat\.(?:com)|(?:nl)/ig.test(activity.sender) and not (activity.sender?.indexOf(config.mail.username) >= 0) and not (activity.sender?.indexOf('brian@codecombat.com') >= 0)
|
||||
return done(null, activity.sender, activity.user_id, lead.id)
|
||||
return done(null, config.mail.supportSchools, lead.id)
|
||||
return done(null, config.mail.supportSchools, defaultSalesContactUser, lead.id)
|
||||
catch error
|
||||
log.error("closeIO.getSalesContactEmail Error for #{email}: #{JSON.stringify(error)}")
|
||||
return done(error)
|
||||
|
||||
sendMail: (fromAddress, subject, content, salesContactEmail, leadID, done) ->
|
||||
# log.info("DEBUG: closeIO.sendMail #{fromAddress} #{subject} #{content}")
|
||||
# log.info("DEBUG: closeIO.sendMail #{fromAddress} #{subject} #{salesContactEmail} #{leadID}")
|
||||
matches = salesContactEmail.match(/^[a-zA-Z_]+ <(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3})>$|(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3})/i)
|
||||
salesContactEmail = matches?[1] ? matches?[2] ? config.mail.supportSchools
|
||||
salesContactEmail = config.mail.supportSchools if salesContactEmail?.indexOf('brian@codecombat.com') >= 0
|
||||
|
||||
postData =
|
||||
to: [salesContactEmail]
|
||||
sender: config.mail.username
|
||||
|
@ -97,6 +97,8 @@ module.exports =
|
|||
return done()
|
||||
|
||||
processLicenseRequest: (teacherEmail, userID, leadID, licensesRequested, amount, done) ->
|
||||
# log.info("DEBUG: closeIO.processLicenseRequest #{teacherEmail} #{userID} #{leadID} #{licensesRequested} #{amount}")
|
||||
|
||||
# Update lead with licenses requested
|
||||
licensesRequested = parseInt(licensesRequested)
|
||||
putData = 'custom.licensesRequested': licensesRequested
|
||||
|
|
Loading…
Reference in a new issue