mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-26 00:58:00 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
9a59e38bd4
4 changed files with 18 additions and 4 deletions
|
@ -313,7 +313,7 @@ module.exports = class ThangsTabView extends CocoView
|
|||
createEssentialComponents: (defaultComponents) ->
|
||||
physicalConfig = {pos: {x: 10, y: 10, z: 1}}
|
||||
if physicalOriginal = _.find(defaultComponents ? [], original: componentOriginals['physics.Physical'])
|
||||
physicalConfig.pos.z = physicalOriginal.config.pos.z # Get the z right
|
||||
physicalConfig.pos.z = physicalOriginal.config?.pos?.z ? 1 # Get the z right
|
||||
console.log physicalOriginal, defaultComponents, componentOriginals['physics.Physical'], physicalConfig
|
||||
[
|
||||
{original: componentOriginals['existence.Exists'], majorVersion: 0, config: {}}
|
||||
|
|
|
@ -6,6 +6,7 @@ log = require 'winston'
|
|||
Patch = require '../patches/Patch'
|
||||
User = require '../users/User'
|
||||
sendwithus = require '../sendwithus'
|
||||
hipchat = require '../hipchat'
|
||||
|
||||
PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1, created: 1, permissions: 1}
|
||||
FETCH_LIMIT = 300
|
||||
|
@ -370,6 +371,8 @@ module.exports = class Handler
|
|||
parentDocument.makeNewMajorVersion(updatedObject, done)
|
||||
|
||||
notifyWatchersOfChange: (editor, changedDocument, editPath) ->
|
||||
docLink = "http://codecombat.com#{editPath}"
|
||||
@sendChangedHipChatMessage creator: editor, target: changedDocument, docLink: docLink
|
||||
watchers = changedDocument.get('watchers') or []
|
||||
watchers = (w for w in watchers when not w.equals(editor.get('_id')))
|
||||
return unless watchers.length
|
||||
|
@ -390,9 +393,20 @@ module.exports = class Handler
|
|||
commit_message: changedDocument.get('commitMessage')
|
||||
sendwithus.api.send context, (err, result) ->
|
||||
|
||||
sendChangedHipChatMessage: (options) ->
|
||||
message = "#{options.creator.get('name')} saved a change to <a href=\"#{options.docLink}\">#{options.target.get('name')}</a>: #{options.target.get('commitMessage')}"
|
||||
hipchat.sendHipChatMessage message
|
||||
|
||||
makeNewInstance: (req) ->
|
||||
model = new @modelClass({})
|
||||
model.set 'watchers', [req.user.get('_id')] if @modelClass.schema.is_patchable
|
||||
if @modelClass.schema.is_patchable
|
||||
watchers = [req.user.get('_id')]
|
||||
if req.user.isAdmin() # https://github.com/codecombat/codecombat/issues/1105
|
||||
nick = mongoose.Types.ObjectId('512ef4805a67a8c507000001')
|
||||
scott = mongoose.Types.ObjectId('5162fab9c92b4c751e000274')
|
||||
watchers.push nick unless _.find watchers, (id) -> id.equals nick
|
||||
watchers.push scott unless _.find watchers, (id) -> id.equals scott
|
||||
model.set 'watchers', watchers
|
||||
model
|
||||
|
||||
validateDocumentInput: (input) ->
|
||||
|
|
|
@ -22,5 +22,5 @@ module.exports.addDelightedUser = addDelightedUser = (user) ->
|
|||
gender: user.get('gender')
|
||||
lastLevel: user.get('lastLevel')
|
||||
request.post {uri: "https://#{key}:@api.delightedapp.com/v1/people.json", form: form}, (err, res, body) ->
|
||||
return log.error 'Error sending Delighted request:', err or body if err or /error/.test body
|
||||
return log.error 'Error sending Delighted request:', err or body if err or /error/i.test body
|
||||
#log.info "Got DelightedApp response: #{body}"
|
||||
|
|
|
@ -12,5 +12,5 @@ module.exports.sendHipChatMessage = sendHipChatMessage = (message) ->
|
|||
messageFormat: 'html'
|
||||
url = "https://api.hipchat.com/v2/room/#{roomID}/notification?auth_token=#{key}"
|
||||
request.post {uri: url, json: form}, (err, res, body) ->
|
||||
return log.error 'Error sending HipChat patch request:', err or body if err or /error/.test body
|
||||
return log.error 'Error sending HipChat patch request:', err or body if err or /error/i.test body
|
||||
#log.info "Got HipChat patch response:", body
|
||||
|
|
Loading…
Reference in a new issue