diff --git a/app/views/core/ContactModal.coffee b/app/views/core/ContactModal.coffee index 1a7fa17c3..3d8bd01ae 100644 --- a/app/views/core/ContactModal.coffee +++ b/app/views/core/ContactModal.coffee @@ -33,6 +33,7 @@ module.exports = class ContactModal extends ModalView res = tv4.validateMultiple contactMessage, contactSchema return forms.applyErrorsToForm @$el, res.errors unless res.valid @populateBrowserData contactMessage + contactMessage.country = me.get('country') window.tracker?.trackEvent 'Sent Feedback', message: contactMessage sendContactMessage contactMessage, @$el $.post "/db/user/#{me.id}/track/contact_codecombat" diff --git a/server/routes/contact.coffee b/server/routes/contact.coffee index d12fd052a..2afa29980 100644 --- a/server/routes/contact.coffee +++ b/server/routes/contact.coffee @@ -23,6 +23,7 @@ createMailContext = (req, done) -> user = req.user recipientID = req.body.recipientID subject = req.body.subject + country = req.body.country level = if user?.get('points') > 0 then Math.floor(5 * Math.log((1 / 100) * (user.get('points') + 100))) + 1 else 0 premium = user?.isPremium() @@ -30,7 +31,7 @@ createMailContext = (req, done) -> #{message} -- - #{user.get('name') or 'Anonymous'} - Level #{level}#{if premium then ' - Subscriber' else ''} + #{user.get('name') or 'Anonymous'} - Level #{level}#{if premium then ' - Subscriber' else ''}#{if country then ' - ' + country else ''} """ if req.body.browser content += "\n#{req.body.browser} - #{req.body.screenSize}" @@ -46,7 +47,6 @@ createMailContext = (req, done) -> email_data: subject: "[CodeCombat] #{subject ? ('Feedback - ' + (sender or user.get('email')))}" content: content - if recipientID and (user.isAdmin() or ('employer' in (user.get('permissions') ? []))) User.findById(recipientID, 'email').exec (err, document) -> if err