mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
2eb8441911
77 changed files with 96 additions and 81 deletions
|
@ -9,7 +9,6 @@ module.exports = ModuleLoader = class ModuleLoader extends CocoClass
|
|||
@WADS = [
|
||||
'lib'
|
||||
'views/play'
|
||||
'views/game-menu'
|
||||
'views/editor'
|
||||
]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
errorModalTemplate = require 'templates/modal/error'
|
||||
errorModalTemplate = require 'templates/core/error'
|
||||
{applyErrorsToForm} = require 'core/forms'
|
||||
|
||||
module.exports.parseServerError = (text) ->
|
||||
|
@ -42,7 +42,7 @@ module.exports.connectionFailure = connectionFailure = ->
|
|||
showErrorModal(html)
|
||||
|
||||
showErrorModal = (html) ->
|
||||
# TODO: make a views/modal/error_modal view for this to use so the template can reuse templates/modal/modal_base?
|
||||
# TODO: make a views/modal/error_modal view for this to use so the template can reuse templates/core/modal-base?
|
||||
$('#modal-wrapper').html(html)
|
||||
$('.modal:visible').modal('hide')
|
||||
$('#modal-error').modal('show')
|
||||
|
|
|
@ -130,3 +130,13 @@ module.exports.kindaEqual = compare = (l, r) ->
|
|||
return true
|
||||
else
|
||||
return false
|
||||
|
||||
# Fast, basic way to replace text in an element when you don't need much.
|
||||
# http://stackoverflow.com/a/4962398/540620
|
||||
if document?
|
||||
dummy = document.createElement 'div'
|
||||
dummy.innerHTML = 'text'
|
||||
TEXT = if dummy.textContent is 'text' then 'textContent' else 'innerText'
|
||||
module.exports.replaceText = (elems, text) ->
|
||||
elem[TEXT] = text for elem in elems
|
||||
null
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CocoClass = require 'core/CocoClass'
|
||||
PlayHeroesModal = require 'views/play/modal/PlayHeroesModal'
|
||||
InventoryModal = require 'views/game-menu/InventoryModal'
|
||||
InventoryModal = require 'views/play/menu/InventoryModal'
|
||||
LevelSession = require 'models/LevelSession'
|
||||
SuperModel = require 'models/SuperModel'
|
||||
ThangType = require 'models/ThangType'
|
||||
|
|
|
@ -192,7 +192,7 @@ module.exports = class LankBoss extends CocoClass
|
|||
updatedObstacles = []
|
||||
itemsJustEquipped = []
|
||||
for thang in @world.thangs when thang.exists and thang.pos
|
||||
itemsJustEquipped = itemsJustEquipped.concat @equipNewItems thang
|
||||
itemsJustEquipped = itemsJustEquipped.concat @equipNewItems thang if thang.equip
|
||||
if lank = @lanks[thang.id]
|
||||
lank.setThang thang # make sure Lank has latest Thang
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3 Applicant Code for
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
if mode === 'login'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="contact.contact_us") Contact CodeCombat...
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="diplomat_suggestion.title") Help translate CodeCombat!
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h1 Add Components
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.fork_title") Fork New Version
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.new_component_title") Create New Component
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.pick_a_terrain") Pick a Terrain
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
|
||||
block modal-header-content
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.add_system_title") Add Systems to Level
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.create_system_title") Create New System
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
.modal-header-content
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3 Choose Container for Vector Icon
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3 #{confirmTitle}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
if userIsAnonymous || !userIsAuthorized
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/contact
|
||||
extends /templates/core/contact
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="contact.contact_candidate") Contact Candidate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="#{currentNew}") Create New #{modelLabel}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="recover.recover_account_title") Recover Account
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="editor.revert_models") Revert Models
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
if isPatch
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
if dataList
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="wizard_settings.title2") Customize Your Character
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="ladder.choose_opponent") Choose an Opponent
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
block modal-header-content
|
||||
img(src="/images/pages/play/level/modal/victory_modal_blue_banner.png")#victory-banner
|
||||
img(src="/images/pages/play/level/modal/victory_word.png")#victory-header.out
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="play_level.infinite_loop_title") Infinite Loop Detected
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="keyboard_shortcuts.keyboard_shortcuts") Keyboard Shortcuts
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="play_level.reload_title") Reload All Code?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="play.account") Account
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="play.achievements") Achievements
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h1#choose-hero-header.choose-hero-active.secret(data-i18n="choose_hero.choose_hero") Choose Your Hero
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends /templates/modal/modal_base
|
||||
extends /templates/core/modal-base
|
||||
|
||||
block modal-header-content
|
||||
h3(data-i18n="play.settings") Settings
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/community'
|
||||
template = require 'templates/community-view'
|
||||
|
||||
module.exports = class CommunityView extends RootView
|
||||
id: 'community-view'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/home'
|
||||
template = require 'templates/home-view'
|
||||
|
||||
module.exports = class HomeView extends RootView
|
||||
id: 'home-view'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/achievements/achievement-popup'
|
||||
template = require 'templates/core/achievement-popup'
|
||||
User = require '../../models/User'
|
||||
Achievement = require '../../models/Achievement'
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
SuperModel = require 'models/SuperModel'
|
||||
utils = require 'core/utils'
|
||||
CocoClass = require 'core/CocoClass'
|
||||
loadingScreenTemplate = require 'templates/loading'
|
||||
loadingErrorTemplate = require 'templates/loading_error'
|
||||
loadingScreenTemplate = require 'templates/core/loading'
|
||||
loadingErrorTemplate = require 'templates/core/loading-error'
|
||||
|
||||
lastToggleModalCall = 0
|
||||
visibleModal = null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ModalView = require 'views/core/ModalView'
|
||||
template = require 'templates/modal/contact'
|
||||
template = require 'templates/core/contact'
|
||||
|
||||
forms = require 'core/forms'
|
||||
{sendContactMessage} = require 'core/contact'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ModalView = require 'views/core/ModalView'
|
||||
template = require 'templates/modal/diplomat_suggestion'
|
||||
template = require 'templates/core/diplomat-suggestion'
|
||||
{me} = require 'core/auth'
|
||||
forms = require 'core/forms'
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = class ModalView extends CocoView
|
|||
modalWidthPercent: null
|
||||
plain: false
|
||||
instant: false
|
||||
template: require 'templates/modal/modal_base'
|
||||
template: require 'templates/core/modal-base'
|
||||
|
||||
events:
|
||||
'click a': 'toggleModal'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/not_found'
|
||||
template = require 'templates/core/not-found'
|
||||
|
||||
module.exports = class NotFoundView extends RootView
|
||||
id: 'not-found-view'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ModalView = require 'views/core/ModalView'
|
||||
template = require 'templates/modal/model'
|
||||
template = require 'templates/modal/model-modal'
|
||||
|
||||
module.exports = class ModelModal extends ModalView
|
||||
id: 'model-modal'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/main-play-view'
|
||||
template = require 'templates/play/main-play-view'
|
||||
LevelSession = require 'models/LevelSession'
|
||||
CocoCollection = require 'collections/CocoCollection'
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ CocoView = require 'views/core/CocoView'
|
|||
template = require 'templates/play/level/control_bar'
|
||||
{me} = require 'core/auth'
|
||||
|
||||
GameMenuModal = require 'views/game-menu/GameMenuModal'
|
||||
GameMenuModal = require 'views/play/menu/GameMenuModal'
|
||||
RealTimeModel = require 'models/RealTimeModel'
|
||||
RealTimeCollection = require 'collections/RealTimeCollection'
|
||||
LevelSetupManager = require 'lib/LevelSetupManager'
|
||||
GameMenuModal = require 'views/game-menu/GameMenuModal'
|
||||
GameMenuModal = require 'views/play/menu/GameMenuModal'
|
||||
CampaignOptions = require 'lib/CampaignOptions'
|
||||
|
||||
module.exports = class ControlBarView extends CocoView
|
||||
|
|
|
@ -2,6 +2,7 @@ CocoView = require 'views/core/CocoView'
|
|||
template = require 'templates/play/level/hud'
|
||||
prop_template = require 'templates/play/level/hud_prop'
|
||||
LevelOptions = require 'lib/LevelOptions'
|
||||
utils = require 'core/utils'
|
||||
|
||||
module.exports = class LevelHUDView extends CocoView
|
||||
id: 'thang-hud'
|
||||
|
@ -104,7 +105,7 @@ module.exports = class LevelHUDView extends CocoView
|
|||
name = {knight: 'Tharin', captain: 'Anya', librarian: 'Hushbaum', sorcerer: 'Pender', 'potion-master': 'Omarn', samurai: 'Hattori', ninja: 'Amara'}[@thang.type] ? 'Hero'
|
||||
else
|
||||
name = if @thang.type then "#{@thang.id} - #{@thang.type}" else @thang.id
|
||||
@$el.find('.thang-name').text name
|
||||
utils.replaceText @$el.find('.thang-name'), name
|
||||
props = @$el.find('.thang-props')
|
||||
props.find('.prop').remove()
|
||||
#propNames = _.without @thang.hudProperties ? [], 'action'
|
||||
|
@ -145,7 +146,7 @@ module.exports = class LevelHUDView extends CocoView
|
|||
labelText = prop + ': ' + @formatValue(prop, val) + ' / ' + @formatValue(prop, max)
|
||||
if regen
|
||||
labelText += ' (+' + @formatValue(prop, regen) + '/s)'
|
||||
pel.find('.bar-prop-value').text(Math.round(max)) if max
|
||||
utils.replaceText pel.find('.bar-prop-value'), Math.round(val)
|
||||
else
|
||||
s = @formatValue(prop, val)
|
||||
labelText = "#{prop}: #{s}"
|
||||
|
@ -153,7 +154,7 @@ module.exports = class LevelHUDView extends CocoView
|
|||
cooldown = @thang.actions.attack.cooldown
|
||||
dps = @thang.attackDamage / cooldown
|
||||
labelText += " / #{cooldown.toFixed(2)}s (DPS: #{dps.toFixed(2)})"
|
||||
pel.find('.prop-value').text s
|
||||
utils.replaceText pel.find('.prop-value'), s
|
||||
pel.attr 'title', labelText
|
||||
pel
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
ModalView = require 'views/core/ModalView'
|
||||
template = require 'templates/game-menu/game-menu-modal'
|
||||
template = require 'templates/play/menu/game-menu-modal'
|
||||
submenuViews = [
|
||||
require 'views/game-menu/SaveLoadView'
|
||||
require 'views/game-menu/OptionsView'
|
||||
require 'views/game-menu/GuideView'
|
||||
require 'views/game-menu/MultiplayerView'
|
||||
require 'views/play/menu/SaveLoadView'
|
||||
require 'views/play/menu/OptionsView'
|
||||
require 'views/play/menu/GuideView'
|
||||
require 'views/play/menu/MultiplayerView'
|
||||
]
|
||||
|
||||
module.exports = class GameMenuModal extends ModalView
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/game-menu/guide-view'
|
||||
template = require 'templates/play/menu/guide-view'
|
||||
Article = require 'models/Article'
|
||||
utils = require 'core/utils'
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
ModalView = require 'views/core/ModalView'
|
||||
template = require 'templates/game-menu/inventory-modal'
|
||||
template = require 'templates/play/menu/inventory-modal'
|
||||
buyGemsPromptTemplate = require 'templates/play/modal/buy-gems-prompt'
|
||||
{me} = require 'core/auth'
|
||||
ThangType = require 'models/ThangType'
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/game-menu/item-view'
|
||||
template = require 'templates/play/menu/item-view'
|
||||
|
||||
module.exports = class ItemView extends CocoView
|
||||
className: 'item-view'
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/game-menu/multiplayer-view'
|
||||
template = require 'templates/play/menu/multiplayer-view'
|
||||
{me} = require 'core/auth'
|
||||
ThangType = require 'models/ThangType'
|
||||
LadderSubmissionView = require 'views/play/common/LadderSubmissionView'
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/game-menu/options-view'
|
||||
template = require 'templates/play/menu/options-view'
|
||||
{me} = require 'core/auth'
|
||||
ThangType = require 'models/ThangType'
|
||||
User = require 'models/User'
|
|
@ -1,5 +1,5 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/game-menu/save-load-view'
|
||||
template = require 'templates/play/menu/save-load-view'
|
||||
{me} = require 'core/auth'
|
||||
ThangType = require 'models/ThangType'
|
||||
|
|
@ -35,7 +35,6 @@
|
|||
"aether": "~0.2.39",
|
||||
"underscore.string": "~2.3.3",
|
||||
"firebase": "~1.0.2",
|
||||
"catiline": "~2.9.3",
|
||||
"d3": "~3.4.4",
|
||||
"jsondiffpatch": "0.1.8",
|
||||
"nanoscroller": "~0.8.0",
|
||||
|
|
|
@ -72,7 +72,6 @@ exports.config =
|
|||
#- Wads. Groups of modules by folder which are loaded as a group when needed.
|
||||
'javascripts/app/lib.js': regJoin('^app/lib')
|
||||
'javascripts/app/views/play.js': regJoin('^app/views/play')
|
||||
'javascripts/app/views/game-menu.js': regJoin('^app/views/game-menu')
|
||||
'javascripts/app/views/editor.js': regJoin('^app/views/editor')
|
||||
|
||||
#- world.js, used by the worker to generate the world in game
|
||||
|
@ -140,17 +139,7 @@ exports.config =
|
|||
templates:
|
||||
defaultExtension: 'jade'
|
||||
joinTo:
|
||||
'javascripts/app.js': [
|
||||
regJoin('^app/templates/core')
|
||||
'app/templates/modal/error.jade'
|
||||
'app/templates/not_found.jade'
|
||||
'app/templates/achievements/achievement-popup.jade'
|
||||
'app/templates/loading.jade'
|
||||
'app/templates/loading_error.jade'
|
||||
'app/templates/modal/contact.jade'
|
||||
'app/templates/modal/modal_base.jade'
|
||||
'app/templates/modal/diplomat_suggestion.jade'
|
||||
]
|
||||
'javascripts/app.js': regJoin('^app/templates/core')
|
||||
'javascripts/app/views/play.js': regJoin('^app/templates/play')
|
||||
'javascripts/app/views/game-menu.js': regJoin('^app/templates/game-menu')
|
||||
'javascripts/app/views/editor.js': regJoin('^app/templates/editor')
|
||||
|
@ -196,7 +185,19 @@ for file in coffeeFiles
|
|||
outputFile = file.replace('.coffee', '.js').replace('./app', 'javascripts/app')
|
||||
exports.config.files.javascripts.joinTo[outputFile] = inputFile
|
||||
|
||||
numBundles = 0
|
||||
|
||||
for file in jadeFiles
|
||||
inputFile = file.replace('./app', 'app')
|
||||
outputFile = file.replace('.jade', '.js').replace('./app', 'javascripts/app')
|
||||
exports.config.files.templates.joinTo[outputFile] = inputFile
|
||||
|
||||
#- If a view template name matches its view, bundle it in there.
|
||||
templateFileName = outputFile.match(/[^/]+$/)[0]
|
||||
viewFileName = _.str.capitalize(_.str.camelize(templateFileName))
|
||||
possibleViewFilePath = outputFile.replace(templateFileName, viewFileName).replace('/templates/', '/views/')
|
||||
if exports.config.files.javascripts.joinTo[possibleViewFilePath]
|
||||
exports.config.files.templates.joinTo[possibleViewFilePath] = inputFile
|
||||
numBundles += 1
|
||||
|
||||
console.log 'Bundled', numBundles, 'templates with their views.'
|
|
@ -298,6 +298,8 @@ module.exports = class Handler
|
|||
|
||||
getLatestVersion: (req, res, original, version) ->
|
||||
# can get latest overall version, latest of a major version, or a specific version
|
||||
return @sendBadInputError(res, 'Invalid MongoDB id: '+original) if not Handler.isID(original)
|
||||
|
||||
query = { 'original': mongoose.Types.ObjectId(original) }
|
||||
if version?
|
||||
version = version.split('.')
|
||||
|
|
|
@ -42,7 +42,10 @@ developmentLogging = (tokens, req, res) ->
|
|||
setupErrorMiddleware = (app) ->
|
||||
app.use (err, req, res, next) ->
|
||||
if err
|
||||
res.status(500).send(error: "Something went wrong!")
|
||||
if err.status and 400 <= err.status < 500
|
||||
res.status(err.status).send("Error #{err.status}")
|
||||
return
|
||||
res.status(err.status ? 500).send(error: "Something went wrong!")
|
||||
message = "Express error: #{req.method} #{req.path}: #{err.message}"
|
||||
log.error "#{message}, stack: #{err.stack}"
|
||||
hipchat.sendTowerHipChatMessage(message)
|
||||
|
|
Loading…
Reference in a new issue