From b7d1ab2b011ceba0d796600df2f63e22e98d7605 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 11 May 2015 18:53:42 -0700 Subject: [PATCH] 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. --- app/lib/Angel.coffee | 6 +++++- server/routes/contact.coffee | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/lib/Angel.coffee b/app/lib/Angel.coffee index 32aa7b1bb..eaa0d762c 100644 --- a/app/lib/Angel.coffee +++ b/app/lib/Angel.coffee @@ -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 diff --git a/server/routes/contact.coffee b/server/routes/contact.coffee index b441416e7..d12fd052a 100644 --- a/server/routes/contact.coffee +++ b/server/routes/contact.coffee @@ -66,9 +66,10 @@ createMailContext = (req, done) -> context.email_data.content += "\n" done context - if /Level Load Error/.test context.email_data.subject - message = "#{user.get('name') or user.get('email')} saw #{context.email_data.subject} (level editor)" - 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} (level editor)" + # hipchat.sendHipChatMessage message, ['tower'], color: 'red' fetchRecentSessions = (user, context, callback) ->