Not sending HipChat messages for level load errors. Not sending level load errors for level editor loads. Not sending more than one level load error report per session.

This commit is contained in:
Nick Winter 2015-05-11 18:53:42 -07:00
parent 3072e5f198
commit b7d1ab2b01
2 changed files with 9 additions and 4 deletions

View file

@ -7,6 +7,8 @@ CocoClass = require 'core/CocoClass'
GoalManager = require 'lib/world/GoalManager'
{sendContactMessage} = require 'core/contact'
reportedLoadErrorAlready = false
module.exports = class Angel extends CocoClass
@nicks: ['Archer', 'Lana', 'Cyril', 'Pam', 'Cheryl', 'Woodhouse', 'Ray', 'Krieger']
@ -180,6 +182,8 @@ module.exports = class Angel extends CocoClass
@fireWorker()
reportLoadError: ->
return if me.isAdmin() or /dev=true/.test(window.location?.href ? '') or reportedLoadErrorAlready
reportedLoadErrorAlready = true
context = email: me.get('email')
context.message = "Automatic Report - Unable to Load Level\nLogs:\n" + @allLogs.join('\n')
if $.browser
@ -187,7 +191,7 @@ module.exports = class Angel extends CocoClass
context.screenSize = "#{screen?.width ? $(window).width()} x #{screen?.height ? $(window).height()}"
context.subject = "Level Load Error: #{@work?.level?.name or 'Unknown Level'}"
context.levelSlug = @work?.level?.slug
sendContactMessage context unless me.isAdmin()
sendContactMessage context
doWork: ->
return if @aborting

View file

@ -66,9 +66,10 @@ createMailContext = (req, done) ->
context.email_data.content += "\n<img src='#{req.body.screenshotURL}' />"
done context
if /Level Load Error/.test context.email_data.subject
message = "#{user.get('name') or user.get('email')} saw #{context.email_data.subject} <a href=\"http://direct.codecombat.com/editor/level/#{req.body.levelSlug}\">(level editor)</a>"
hipchat.sendHipChatMessage message, ['tower'], color: 'red'
# I'll try having it just send the emails instead of spamming the chat.
#if /Level Load Error/.test context.email_data.subject
# message = "#{user.get('name') or user.get('email')} saw #{context.email_data.subject} <a href=\"http://direct.codecombat.com/editor/level/#{req.body.levelSlug}\">(level editor)</a>"
# hipchat.sendHipChatMessage message, ['tower'], color: 'red'
fetchRecentSessions = (user, context, callback) ->