Replace HipChat with Slack

This commit is contained in:
Matt Lott 2016-03-18 17:05:21 -07:00
parent 905c9cdb93
commit 5d71acba05
20 changed files with 75 additions and 44 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -868,7 +868,7 @@
social_facebook: "Like CodeCombat on Facebook" social_facebook: "Like CodeCombat on Facebook"
social_twitter: "Follow CodeCombat on Twitter" social_twitter: "Follow CodeCombat on Twitter"
social_gplus: "Join CodeCombat on Google+" social_gplus: "Join CodeCombat on Google+"
social_hipchat: "Chat with us in the public CodeCombat Slack channel" social_slack: "Chat with us in the public CodeCombat Slack channel"
contribute_to_the_project: "Contribute to the project" contribute_to_the_project: "Contribute to the project"
clans: clans:
@ -1294,7 +1294,7 @@
join_desc_3: ", or find us in our " join_desc_3: ", or find us in our "
join_desc_4: "and we'll go from there!" join_desc_4: "and we'll go from there!"
join_url_email: "Email us" join_url_email: "Email us"
join_url_hipchat: "public Slack channel" join_url_slack: "public Slack channel"
archmage_subscribe_desc: "Get emails on new coding opportunities and announcements." archmage_subscribe_desc: "Get emails on new coding opportunities and announcements."
artisan_introduction_pref: "We must construct additional levels! People be clamoring for more content, and we can only build so many ourselves. Right now your workstation is level one; our level editor is barely usable even by its creators, so be wary. If you have visions of campaigns spanning for-loops to" artisan_introduction_pref: "We must construct additional levels! People be clamoring for more content, and we can only build so many ourselves. Right now your workstation is level one; our level editor is barely usable even by its creators, so be wary. If you have visions of campaigns spanning for-loops to"
artisan_introduction_suf: ", then this class might be for you." artisan_introduction_suf: ", then this class might be for you."

View file

@ -66,7 +66,7 @@ block content
img(src="/images/pages/community/logo_g+.png", data-i18n="[data-content]community.social_gplus" data-content="Join CodeCombat on Google+") img(src="/images/pages/community/logo_g+.png", data-i18n="[data-content]community.social_gplus" data-content="Join CodeCombat on Google+")
a(href="https://coco-slack-invite.herokuapp.com/") a(href="https://coco-slack-invite.herokuapp.com/")
img(src="/images/pages/community/logo_hipchat.png", data-i18n="[data-content]community.social_hipchat" data-content="Chat with us in the public CodeCombat Slack channel") img(src="/images/pages/community/logo_slack.png", data-i18n="[data-content]community.social_slack" data-content="Chat with us in the public CodeCombat Slack channel")
.half-width .half-width

View file

@ -51,7 +51,7 @@ block content
| Email us | Email us
span(data-i18n="contribute.join_desc_3") span(data-i18n="contribute.join_desc_3")
| , or find us in our | , or find us in our
a(href="https://coco-slack-invite.herokuapp.com/", data-i18n="contribute.join_url_hipchat") public Slack channel a(href="https://coco-slack-invite.herokuapp.com/", data-i18n="contribute.join_url_slack") public Slack channel
span span
span(data-i18n="contribute.join_desc_4") span(data-i18n="contribute.join_desc_4")
| and we'll go from there! | and we'll go from there!

View file

@ -76,10 +76,10 @@ if cluster.isMaster
message = "Worker #{worker.id} died! #{deaths[Math.floor Math.random() * deaths.length]}" message = "Worker #{worker.id} died! #{deaths[Math.floor Math.random() * deaths.length]}"
console.log message console.log message
try try
hipchat = require './server/hipchat' slack = require './server/slack'
hipchat.sendHipChatMessage(message, ['tower'], {papertrail: true}) slack.sendSlackMessage(message, ['tower'], {papertrail: true})
catch error catch error
console.log "Couldn't send HipChat message on server death:", error console.log "Couldn't send Slack message on server death:", error
cluster.fork() cluster.fork()
else else
require('coffee-script') require('coffee-script')

View file

@ -126,7 +126,7 @@ CampaignHandler = class CampaignHandler extends Handler
onPutSuccess: (req, doc) -> onPutSuccess: (req, doc) ->
docLink = "http://codecombat.com#{req.headers['x-current-path']}" docLink = "http://codecombat.com#{req.headers['x-current-path']}"
@sendChangedHipChatMessage creator: req.user, target: doc, docLink: docLink @sendChangedSlackMessage creator: req.user, target: doc, docLink: docLink
getNamesByIDs: (req, res) -> @getNamesByOriginals req, res, true getNamesByIDs: (req, res) -> @getNamesByOriginals req, res, true

View file

@ -6,7 +6,7 @@ log = require 'winston'
Patch = require '../patches/Patch' Patch = require '../patches/Patch'
User = require '../users/User' User = require '../users/User'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
hipchat = require '../hipchat' slack = require '../slack'
deltasLib = require '../../app/core/deltas' deltasLib = require '../../app/core/deltas'
PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1, created: 1, permissions: 1} PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1, created: 1, permissions: 1}
@ -457,7 +457,7 @@ module.exports = class Handler
notifyWatchersOfChange: (editor, changedDocument, editPath) -> notifyWatchersOfChange: (editor, changedDocument, editPath) ->
docLink = "http://codecombat.com#{editPath}" docLink = "http://codecombat.com#{editPath}"
@sendChangedHipChatMessage creator: editor, target: changedDocument, docLink: docLink @sendChangedSlackMessage creator: editor, target: changedDocument, docLink: docLink
watchers = changedDocument.get('watchers') or [] watchers = changedDocument.get('watchers') or []
# Don't send these emails to the person who submitted the patch, or to Nick, George, or Scott. # Don't send these emails to the person who submitted the patch, or to Nick, George, or Scott.
watchers = (w for w in watchers when not w.equals(editor.get('_id')) and not (w + '' in ['512ef4805a67a8c507000001', '5162fab9c92b4c751e000274', '51538fdb812dd9af02000001'])) watchers = (w for w in watchers when not w.equals(editor.get('_id')) and not (w + '' in ['512ef4805a67a8c507000001', '5162fab9c92b4c751e000274', '51538fdb812dd9af02000001']))
@ -479,10 +479,10 @@ module.exports = class Handler
commit_message: changedDocument.get('commitMessage') commit_message: changedDocument.get('commitMessage')
sendwithus.api.send context, (err, result) -> sendwithus.api.send context, (err, result) ->
sendChangedHipChatMessage: (options) -> sendChangedSlackMessage: (options) ->
message = "#{options.creator.get('name')} saved a change to <a href=\"#{options.docLink}\">#{options.target.get('name')}</a>: #{options.target.get('commitMessage') or '(no commit message)'}" message = "#{options.creator.get('name')} saved a change to <a href=\"#{options.docLink}\">#{options.target.get('name')}</a>: #{options.target.get('commitMessage') or '(no commit message)'}"
rooms = if /Diplomat submission/.test(message) then ['main'] else ['main', 'artisans'] rooms = if /Diplomat submission/.test(message) then ['main'] else ['main', 'artisans']
hipchat.sendHipChatMessage message, rooms slack.sendSlackMessage message, rooms
makeNewInstance: (req) -> makeNewInstance: (req) ->
model = new @modelClass({}) model = new @modelClass({})

View file

@ -2,7 +2,7 @@ utils = require '../lib/utils'
errors = require '../commons/errors' errors = require '../commons/errors'
User = require '../users/User' User = require '../users/User'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
hipchat = require '../hipchat' slack = require '../slack'
_ = require 'lodash' _ = require 'lodash'
wrap = require 'co-express' wrap = require 'co-express'
mongoose = require 'mongoose' mongoose = require 'mongoose'
@ -94,10 +94,10 @@ module.exports =
editPath = req.headers['x-current-path'] editPath = req.headers['x-current-path']
docLink = "http://codecombat.com#{editPath}" docLink = "http://codecombat.com#{editPath}"
# Post a message on HipChat # Post a message on Slack
message = "#{req.user.get('name')} saved a change to <a href=\"#{docLink}\">#{doc.get('name')}</a>: #{doc.get('commitMessage') or '(no commit message)'}" message = "#{req.user.get('name')} saved a change to <a href=\"#{docLink}\">#{doc.get('name')}</a>: #{doc.get('commitMessage') or '(no commit message)'}"
rooms = if /Diplomat submission/.test(message) then ['main'] else ['main', 'artisans'] rooms = if /Diplomat submission/.test(message) then ['main'] else ['main', 'artisans']
hipchat.sendHipChatMessage message, rooms slack.sendSlackMessage message, rooms
# Send emails to watchers # Send emails to watchers
watchers = doc.get('watchers') or [] watchers = doc.get('watchers') or []

View file

@ -2,7 +2,6 @@ closeIO = require '../lib/closeIO'
log = require 'winston' log = require 'winston'
mongoose = require 'mongoose' mongoose = require 'mongoose'
config = require '../../server_config' config = require '../../server_config'
hipchat = require '../hipchat'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
Prepaid = require '../prepaids/Prepaid' Prepaid = require '../prepaids/Prepaid'
jsonSchema = require '../../app/schemas/models/trial_request.schema' jsonSchema = require '../../app/schemas/models/trial_request.schema'

View file

@ -6,7 +6,7 @@ schema = require '../../app/schemas/models/patch'
mongoose = require 'mongoose' mongoose = require 'mongoose'
log = require 'winston' log = require 'winston'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
hipchat = require '../hipchat' slack = require '../slack'
PatchHandler = class PatchHandler extends Handler PatchHandler = class PatchHandler extends Handler
modelClass: Patch modelClass: Patch
@ -88,7 +88,7 @@ PatchHandler = class PatchHandler extends Handler
log.error 'Error sending patch created: could not find the loaded target on the patch object.' unless doc.targetLoaded log.error 'Error sending patch created: could not find the loaded target on the patch object.' unless doc.targetLoaded
return unless doc.targetLoaded return unless doc.targetLoaded
docLink = "http://codecombat.com#{req.headers['x-current-path']}" docLink = "http://codecombat.com#{req.headers['x-current-path']}"
@sendPatchCreatedHipChatMessage creator: req.user, patch: doc, target: doc.targetLoaded, docLink: docLink @sendPatchCreatedSlackMessage creator: req.user, patch: doc, target: doc.targetLoaded, docLink: docLink
watchers = doc.targetLoaded.get('watchers') or [] watchers = doc.targetLoaded.get('watchers') or []
# Don't send these emails to the person who submitted the patch, or to Nick, George, or Scott. # Don't send these emails to the person who submitted the patch, or to Nick, George, or Scott.
watchers = (w for w in watchers when not w.equals(req.user.get('_id')) and not (w + '' in ['512ef4805a67a8c507000001', '5162fab9c92b4c751e000274', '51538fdb812dd9af02000001'])) watchers = (w for w in watchers when not w.equals(req.user.get('_id')) and not (w + '' in ['512ef4805a67a8c507000001', '5162fab9c92b4c751e000274', '51538fdb812dd9af02000001']))
@ -111,8 +111,8 @@ PatchHandler = class PatchHandler extends Handler
commit_message: patch.get('commitMessage') commit_message: patch.get('commitMessage')
sendwithus.api.send context, (err, result) -> sendwithus.api.send context, (err, result) ->
sendPatchCreatedHipChatMessage: (options) -> sendPatchCreatedSlackMessage: (options) ->
message = "#{options.creator.get('name')} submitted a patch to <a href=\"#{options.docLink}\">#{options.target.get('name')}</a>: #{options.patch.get('commitMessage')}" message = "#{options.creator.get('name')} submitted a patch to <a href=\"#{options.docLink}\">#{options.target.get('name')}</a>: #{options.patch.get('commitMessage')}"
hipchat.sendHipChatMessage message, ['main'] slack.sendSlackMessage message, ['main']
module.exports = new PatchHandler() module.exports = new PatchHandler()

View file

@ -7,7 +7,7 @@ Handler = require '../commons/Handler'
mongoose = require 'mongoose' mongoose = require 'mongoose'
log = require 'winston' log = require 'winston'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
hipchat = require '../hipchat' slack = require '../slack'
config = require '../../server_config' config = require '../../server_config'
request = require 'request' request = require 'request'
async = require 'async' async = require 'async'
@ -178,7 +178,7 @@ PaymentHandler = class PaymentHandler extends Handler
if err if err
@logPaymentError(req, 'Apple incr db error.'+err) @logPaymentError(req, 'Apple incr db error.'+err)
return @sendDatabaseError(res, err) return @sendDatabaseError(res, err)
@sendPaymentHipChatMessage user: req.user, payment: payment @sendPaymentSlackMessage user: req.user, payment: payment
@sendCreated(res, @formatEntity(req, payment)) @sendCreated(res, @formatEntity(req, payment))
) )
) )
@ -270,7 +270,7 @@ PaymentHandler = class PaymentHandler extends Handler
if err if err
@logPaymentError(req, 'Stripe recalc db error. '+err) @logPaymentError(req, 'Stripe recalc db error. '+err)
return @sendDatabaseError(res, err) return @sendDatabaseError(res, err)
@sendPaymentHipChatMessage user: req.user, payment: payment @sendPaymentSlackMessage user: req.user, payment: payment
@sendSuccess(res, @formatEntity(req, payment)) @sendSuccess(res, @formatEntity(req, payment))
) )
) )
@ -333,7 +333,7 @@ PaymentHandler = class PaymentHandler extends Handler
if err if err
@logPaymentError(req, 'Stripe incr db error. '+err) @logPaymentError(req, 'Stripe incr db error. '+err)
return @sendDatabaseError(res, err) return @sendDatabaseError(res, err)
@sendPaymentHipChatMessage user: req.user, payment: payment @sendPaymentSlackMessage user: req.user, payment: payment
@sendCreated(res, @formatEntity(req, payment)) @sendCreated(res, @formatEntity(req, payment))
) )
) )
@ -403,12 +403,12 @@ PaymentHandler = class PaymentHandler extends Handler
user.save((err) -> done(err)) user.save((err) -> done(err))
) )
sendPaymentHipChatMessage: (options) -> sendPaymentSlackMessage: (options) ->
try try
message = "#{options.user?.get('name')} bought #{options.payment?.get('amount')} via #{options.payment?.get('service')}" message = "#{options.user?.get('name')} bought #{options.payment?.get('amount')} via #{options.payment?.get('service')}"
message += " for #{options.payment.get('description')}" if options.payment?.get('description') message += " for #{options.payment.get('description')}" if options.payment?.get('description')
hipchat.sendHipChatMessage message, ['tower'] slack.sendSlackMessage message, ['tower']
catch e catch e
log.error "Couldn't send HipChat message on payment because of error: #{e}" log.error "Couldn't send Slack message on payment because of error: #{e}"
module.exports = new PaymentHandler() module.exports = new PaymentHandler()

View file

@ -7,7 +7,7 @@ mongoose = require 'mongoose'
async = require 'async' async = require 'async'
config = require '../../server_config' config = require '../../server_config'
Handler = require '../commons/Handler' Handler = require '../commons/Handler'
hipchat = require '../hipchat' slack = require '../slack'
discountHandler = require './discount_handler' discountHandler = require './discount_handler'
Prepaid = require '../prepaids/Prepaid' Prepaid = require '../prepaids/Prepaid'
User = require '../users/User' User = require '../users/User'
@ -185,9 +185,9 @@ class SubscriptionHandler extends Handler
return @sendDatabaseError(res, err) return @sendDatabaseError(res, err)
try try
msg = "Year subscription purchased by #{req.user.get('email')} #{req.user.id}" msg = "Year subscription purchased by #{req.user.get('email')} #{req.user.id}"
hipchat.sendHipChatMessage msg, ['tower'] slack.sendSlackMessage msg, ['tower']
catch error catch error
@logSubscriptionError(req.user, "Year sub sale HipChat tower msg error: #{JSON.stringify(error)}") @logSubscriptionError(req.user, "Year sub sale Slack tower msg error: #{JSON.stringify(error)}")
@sendSuccess(res, user) @sendSuccess(res, user)
subscribeWithPrepaidCode: (req, res) -> subscribeWithPrepaidCode: (req, res) ->

View file

@ -1,6 +1,6 @@
Course = require '../courses/Course' Course = require '../courses/Course'
Handler = require '../commons/Handler' Handler = require '../commons/Handler'
hipchat = require '../hipchat' slack = require '../slack'
Prepaid = require './Prepaid' Prepaid = require './Prepaid'
User = require '../users/User' User = require '../users/User'
StripeUtils = require '../lib/stripe_utils' StripeUtils = require '../lib/stripe_utils'
@ -212,7 +212,7 @@ PrepaidHandler = class PrepaidHandler extends Handler
@logError(user, "createPayment error: #{JSON.stringify(err)}") @logError(user, "createPayment error: #{JSON.stringify(err)}")
return done(err) return done(err)
msg = "Prepaid code purchased: #{type} seats=#{maxRedeemers} #{user.get('email')}" msg = "Prepaid code purchased: #{type} seats=#{maxRedeemers} #{user.get('email')}"
hipchat.sendHipChatMessage msg, ['tower'] slack.sendSlackMessage msg, ['tower']
done(null, prepaid) done(null, prepaid)
purchasePrepaidTerminalSubscription: (user, description, maxRedeemers, months, timestamp, token, product, done) -> purchasePrepaidTerminalSubscription: (user, description, maxRedeemers, months, timestamp, token, product, done) ->
@ -249,7 +249,7 @@ PrepaidHandler = class PrepaidHandler extends Handler
@logError(user, "createPayment error: #{JSON.stringify(err)}") @logError(user, "createPayment error: #{JSON.stringify(err)}")
return done(err) return done(err)
msg = "Prepaid code purchased: #{type} users=#{maxRedeemers} months=#{months} #{user.get('email')}" msg = "Prepaid code purchased: #{type} users=#{maxRedeemers} months=#{months} #{user.get('email')}"
hipchat.sendHipChatMessage msg, ['tower'] slack.sendSlackMessage msg, ['tower']
done(null, prepaid) done(null, prepaid)
get: (req, res) -> get: (req, res) ->

View file

@ -5,7 +5,6 @@ sendwithus = require '../sendwithus'
async = require 'async' async = require 'async'
LevelSession = require '../levels/sessions/LevelSession' LevelSession = require '../levels/sessions/LevelSession'
moment = require 'moment' moment = require 'moment'
hipchat = require '../hipchat'
module.exports.setup = (app) -> module.exports.setup = (app) ->
app.post '/contact', (req, res) -> app.post '/contact', (req, res) ->

View file

@ -3,7 +3,7 @@ errors = require '../commons/errors'
handlers = require('../commons/mapping').handlers handlers = require('../commons/mapping').handlers
handlerUrlOverrides = require('../commons/mapping').handlerUrlOverrides handlerUrlOverrides = require('../commons/mapping').handlerUrlOverrides
mongoose = require 'mongoose' mongoose = require 'mongoose'
hipchat = require '../hipchat' slack = require '../slack'
module.exports.setup = (app) -> module.exports.setup = (app) ->
# This is hacky and should probably get moved somewhere else, I dunno # This is hacky and should probably get moved somewhere else, I dunno
@ -50,7 +50,7 @@ module.exports.setup = (app) ->
log.error(error.stack) log.error(error.stack)
# TODO: Generally ignore this error: error: Error trying db method get route analytics.log.event from undefined: Error: Cannot find module '../undefined' # TODO: Generally ignore this error: error: Error trying db method get route analytics.log.event from undefined: Error: Cannot find module '../undefined'
unless "#{parts}" in ['analytics.users.active'] unless "#{parts}" in ['analytics.users.active']
hipchat.sendHipChatMessage errorMessage, ['tower'], papertrail: true slack.sendSlackMessage errorMessage, ['tower'], papertrail: true
errors.notFound(res, "Route #{req?.path} not found.") errors.notFound(res, "Route #{req?.path} not found.")
app.all '/db/' + moduleName + '/*', routeHandler app.all '/db/' + moduleName + '/*', routeHandler

31
server/slack.coffee Normal file
View file

@ -0,0 +1,31 @@
config = require '../server_config'
request = require 'request'
log = require 'winston'
roomChannelMap =
main: '#general'
artisans: '#artisan'
module.exports.sendSlackMessage = sendSlackMessage = (message, rooms=['tower'], options={}) ->
return unless config.isProduction
unless token = config.slackToken
log.info "No Slack token."
return
for room in rooms
channel = roomChannelMap[room] ? room
form =
channel: channel
token: token
text: message
if options.papertrail
secondsFromEpoch = Math.floor(new Date().getTime() / 1000)
link = "https://papertrailapp.com/groups/488214/events?time=#{secondsFromEpoch}"
form.text += " #{link}"
# https://api.slack.com/docs/formatting
form.text = form.text.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
url = "https://slack.com/api/chat.postMessage"
request.post {uri: url, form: form}, (err, res, body) ->
return log.errr('Error sending Slack message:', err) if err
return log.error("Slack returned error: #{body.error}") unless body.ok
log.warn("Slack returned warning: #{body.warning}") if body.warning
# log.info "Got Slack message response:", body

View file

@ -21,7 +21,7 @@ EarnedAchievement = require '../achievements/EarnedAchievement'
UserRemark = require './remarks/UserRemark' UserRemark = require './remarks/UserRemark'
{findStripeSubscription} = require '../lib/utils' {findStripeSubscription} = require '../lib/utils'
{isID} = require '../lib/utils' {isID} = require '../lib/utils'
hipchat = require '../hipchat' slack = require '../slack'
sendwithus = require '../sendwithus' sendwithus = require '../sendwithus'
Prepaid = require '../prepaids/Prepaid' Prepaid = require '../prepaids/Prepaid'
UserPollsRecord = require '../polls/UserPollsRecord' UserPollsRecord = require '../polls/UserPollsRecord'
@ -503,7 +503,7 @@ UserHandler = class UserHandler extends Handler
req.user.save (err) => req.user.save (err) =>
return @sendDatabaseError(res, err) if err return @sendDatabaseError(res, err) if err
@sendSuccess(res, {result: 'success'}) @sendSuccess(res, {result: 'success'})
hipchat.sendHipChatMessage "#{req.body.githubUsername or req.user.get('name')} just signed the CLA.", ['main'] slack.sendSlackMessage "#{req.body.githubUsername or req.user.get('name')} just signed the CLA.", ['main']
avatar: (req, res, id) -> avatar: (req, res, id) ->
if not isID(id) if not isID(id)

View file

@ -69,6 +69,8 @@ config.hipchat =
tower: process.env.COCO_HIPCHAT_TOWER_API_KEY or '' tower: process.env.COCO_HIPCHAT_TOWER_API_KEY or ''
artisans: process.env.COCO_HIPCHAT_ARTISANS_API_KEY or '' artisans: process.env.COCO_HIPCHAT_ARTISANS_API_KEY or ''
config.slackToken = process.env.COCO_SLACK_TOKEN or ''
config.queue = config.queue =
accessKeyId: process.env.COCO_AWS_ACCESS_KEY_ID or '' accessKeyId: process.env.COCO_AWS_ACCESS_KEY_ID or ''
secretAccessKey: process.env.COCO_AWS_SECRET_ACCESS_KEY or '' secretAccessKey: process.env.COCO_AWS_SECRET_ACCESS_KEY or ''

View file

@ -16,7 +16,7 @@ config = require './server_config'
auth = require './server/routes/auth' auth = require './server/routes/auth'
routes = require './server/routes' routes = require './server/routes'
UserHandler = require './server/users/user_handler' UserHandler = require './server/users/user_handler'
hipchat = require './server/hipchat' slack = require './server/slack'
Mandate = require './server/models/Mandate' Mandate = require './server/models/Mandate'
global.tv4 = require 'tv4' # required for TreemaUtils to work global.tv4 = require 'tv4' # required for TreemaUtils to work
global.jsondiffpatch = require 'jsondiffpatch' global.jsondiffpatch = require 'jsondiffpatch'
@ -71,7 +71,7 @@ setupErrorMiddleware = (app) ->
res.status(err.status ? 500).send(error: "Something went wrong!") res.status(err.status ? 500).send(error: "Something went wrong!")
message = "Express error: #{req.method} #{req.path}: #{err.message}" message = "Express error: #{req.method} #{req.path}: #{err.message}"
log.error "#{message}, stack: #{err.stack}" log.error "#{message}, stack: #{err.stack}"
hipchat.sendHipChatMessage(message, ['tower'], {papertrail: true}) slack.sendSlackMessage(message, ['tower'], {papertrail: true})
else else
next(err) next(err)

View file

@ -468,11 +468,11 @@ describe 'POST /db/article/:handle/new-version', ->
yield postNewVersion({ name: 'Article name', body: 'New body', commitMessage: 'Commit message' }) yield postNewVersion({ name: 'Article name', body: 'New body', commitMessage: 'Commit message' })
it 'sends a notification to artisan and main HipChat channels', utils.wrap (done) -> it 'sends a notification to artisan and main Slack channels', utils.wrap (done) ->
hipchat = require '../../../server/hipchat' slack = require '../../../server/slack'
spyOn(hipchat, 'sendHipChatMessage') spyOn(slack, 'sendSlackMessage')
yield postNewVersion({ name: 'Article name', body: 'New body' }) yield postNewVersion({ name: 'Article name', body: 'New body' })
expect(hipchat.sendHipChatMessage).toHaveBeenCalled() expect(slack.sendSlackMessage).toHaveBeenCalled()
done() done()
describe 'version fetching endpoints', -> describe 'version fetching endpoints', ->