mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Don't do undefined slug collection scans
This commit is contained in:
parent
24aa11903f
commit
608d45ba70
4 changed files with 17 additions and 12 deletions
|
@ -250,6 +250,7 @@ module.exports.getPrepaidCodeAmount = getPrepaidCodeAmount = (price=999, users=0
|
|||
total
|
||||
|
||||
module.exports.filterMarkdownCodeLanguages = (text) ->
|
||||
return '' unless text
|
||||
currentLanguage = me.get('aceConfig')?.language or 'python'
|
||||
excludedLanguages = _.without ['javascript', 'python', 'coffeescript', 'clojure', 'lua', 'io'], currentLanguage
|
||||
exclusionRegex = new RegExp "```(#{excludedLanguages.join('|')})\n[^`]+```\n?", 'gm'
|
||||
|
|
|
@ -64,6 +64,7 @@ module.exports = class SimulateTabView extends CocoView
|
|||
# Work around simulator getting super slow on Chrome
|
||||
fetchAndSimulateTaskOriginal = @simulator.fetchAndSimulateTask
|
||||
@simulator.fetchAndSimulateTask = =>
|
||||
return if @destroyed
|
||||
if @simulator.simulatedByYou >= 20
|
||||
console.log '------------------- Destroying Simulator and making a new one -----------------'
|
||||
@simulator.destroy()
|
||||
|
|
|
@ -284,7 +284,7 @@ module.exports = class SpellView extends CocoView
|
|||
ar = str.match(/^\s*/)
|
||||
ar.pop().length
|
||||
|
||||
colors = ['50,150,200', '200,150,50']
|
||||
colors = [{border: '74,144,226', fill: '108,162,226'}, {border: '132,180,235', fill: '230,237,245'}]
|
||||
|
||||
for row in [0..@aceSession.getLength()]
|
||||
foldWidgets[row] = @aceSession.getFoldWidget(row) unless foldWidgets[row]?
|
||||
|
@ -316,17 +316,19 @@ module.exports = class SpellView extends CocoView
|
|||
w = 4 * config.characterWidth
|
||||
fw = config.characterWidth * ( @aceSession.getScreenLastRowColumn(range.start.row) - xstart )
|
||||
|
||||
html.push [
|
||||
'<div style="',
|
||||
"position: absolute; top: #{to}px; left: #{l}px; width: #{fw+bw}px; height: #{config.lineHeight}px; background-color: rgba(#{color},0.2);"
|
||||
"border: #{bw}px solid rgba(#{color},0.4); border-left: none",
|
||||
'"></div>' ].join ''
|
||||
|
||||
html.push [
|
||||
'<div style="',
|
||||
"position: absolute; top: #{t}px; left: #{l}px; width: #{w}px; height: #{h}px; background-color: rgba(#{color},0.2);"
|
||||
"border-right: #{bw}px solid rgba(#{color},0.4);",
|
||||
'"></div>' ].join ''
|
||||
html.push """
|
||||
<div style=
|
||||
"position: absolute; top: #{to}px; left: #{l}px; width: #{fw+bw}px; height: #{config.lineHeight}px;
|
||||
border: #{bw}px solid rgba(#{color.border},1); border-left: none;"
|
||||
></div>
|
||||
<div style=
|
||||
"position: absolute; top: #{t}px; left: #{l}px; width: #{w}px; height: #{h}px; background-color: rgba(#{color.fill},0.5);
|
||||
border-right: #{bw}px solid rgba(#{color.border},1); border-bottom: #{bw}px solid rgba(#{color.border},1);"
|
||||
></div>
|
||||
<div style=
|
||||
"position: absolute; top: #{t + h}px; left: #{l}px; width: #{500}px; height: #{bw}px; background-color: rgba(#{color.border},1);"
|
||||
></div>
|
||||
"""
|
||||
|
||||
fillACE: ->
|
||||
@ace.setValue @spell.source
|
||||
|
|
|
@ -504,6 +504,7 @@ module.exports = class Handler
|
|||
if not idOrSlug or idOrSlug is 'undefined'
|
||||
console.error "What? Why are we fetching the slug: #{idOrSlug}?"
|
||||
console.trace()
|
||||
return done null, null
|
||||
query = @modelClass.findOne {slug: idOrSlug}
|
||||
query.select projection if projection
|
||||
query.exec (err, document) ->
|
||||
|
|
Loading…
Reference in a new issue