Change naming for styling purposes. Added some clarity to some test structures.

--- test/logger_test.coffee
+++ test/logger_test.coffee
@@ -17,7 +17,7 @@
   	logObj.setOutput outputFunc

   describe '.constructor', ->
-    it 'constructor', ->
+    it 'passing in parameters to constructor', ->
       formatter = (data) -> data["level"] + "." + data["source"] + "." + data["title"]
       logObj = new logger("logger-test", logger.Info, formatter, outputFunc)
       logObj.debug "testlogdebug"
@@ -27,25 +27,28 @@
       logObj.info "testloginfo"
       expected = logger.Info + ".logger-test.testloginfo"
       assert.equal sample, expected
-  describe '.validatelog', ->
+  describe '.validateloglvl', ->
     # Explicit validation checks
-    it 'validatelog', ->
+    it 'is case-insensitive in log level name', ->
       logLvl = logObj._validateLogLvl "debug"
       assert.equal logLvl, logger.Debug
       logLvl = logObj._validateLogLvl "Debug"
       assert.equal logLvl, logger.Debug

+    it 'sets non-default log levels', ->
       logLvl = logObj._validateLogLvl "info"
       assert.equal logLvl, logger.Info
-      logLvl = logObj._validateLogLvl "Info"
-      assert.equal logLvl, logger.Info
-
+      # TODO: for each possible log level ...
+      logLvl = logObj._validateLogLvl "critical"
+      assert.equal logLvl, logger.Critical
+
+    it 'sets level to Debug, if given an invalid log level', ->
       logLvl = logObj._validateLogLvl "sometest"
       assert.equal logLvl, logger.Debug
   describe '.invalidlog', ->
-    it 'invalidlog', ->
+    it 'check valid debug level JSON output of invalid log level', ->
       # Invalid log levels will default to debug
-      logObj.setLogLevel "debu"
+      logObj.setLogLevel "invalidloglevel"
       logObj.debug "testlogdebug"
       expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Debug + "\", \"title\": \"testlogdebug\"}"
       assert.deepEqual JSON.parse(sample), JSON.parse(expected)
@@ -55,78 +58,78 @@
       expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testloginfo\"}"
       assert.deepEqual JSON.parse(sample), JSON.parse(expected)
   describe '.debug', ->
-  	it 'debug', ->
+  	it 'test debug function', ->
   	  logObj.debug "testlogdebug"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Debug + "\", \"title\": \"testlogdebug\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'debugD', ->
+  	it 'test debugD function', ->
   	  logObj.debugD "testlogdebug", {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Debug + "\", \"title\": \"testlogdebug\",\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.info', ->
-  	it 'info', ->
+  	it 'test info function', ->
   	  logObj.info "testloginfo"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testloginfo\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'infoD', ->
+  	it 'test infoD function', ->
   	  logObj.infoD "testloginfo", {"key1":"val1","key2":"val2"}

   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testloginfo\",\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.warning', ->
-  	it 'warn', ->
+  	it 'test warn function', ->
   	  logObj.warn "testlogwarning"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Warning + "\", \"title\": \"testlogwarning\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'warnD', ->
+  	it 'test warnD function', ->
   	  logObj.warnD "testlogwarning", {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Warning + "\", \"title\": \"testlogwarning\",\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.error', ->
-  	it 'error', ->
+  	it 'test error function', ->
   	  logObj.error "testlogerror"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Error + "\", \"title\": \"testlogerror\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'errorD', ->
+  	it 'test errorD function', ->
   	  logObj.errorD "testlogerror", {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Error + "\", \"title\": \"testlogerror\",\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.critical', ->
-  	it 'critical', ->
+  	it 'test critical function', ->
   	  logObj.critical "testlogcritical"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Critical + "\", \"title\": \"testlogcritical\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'criticalD', ->
+  	it 'test criticalD function', ->
   	  logObj.criticalD "testlogcritical", {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Critical + "\", \"title\": \"testlogcritical\",\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.counter', ->
-  	it 'counter', ->
+  	it 'test counter function', ->
   	  logObj.counter "testlogcounter"
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testlogcounter\", \"type\": \"counter\", \"value\": 1}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'counterD', ->
+  	it 'test counterD function', ->
   	  logObj.counterD "testlogcounter", 2, {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testlogcounter\",\"type\": \"counter\", \"value\": 2,\"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.gauge', ->
-  	it 'gauge', ->
+  	it 'test gauge function', ->
   	  logObj.gauge "testloggauge", 0
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testloggauge\", \"type\": \"gauge\", \"value\": 0}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)
-  	it 'gaugeD', ->
+  	it 'test gaugeD function', ->
   	  logObj.gaugeD "testloggauge", 4, {"key1":"val1","key2":"val2"}
   	  expected = "{\"source\": \"logger-tester\", \"level\": \"" + logger.Info + "\", \"title\": \"testloggauge\", \"type\": \"gauge\", \"value\": 4, \"key1\": \"val1\", \"key2\": \"val2\"}"
   	  assert.deepEqual JSON.parse(sample), JSON.parse(expected)

   describe '.diffoutput', ->
-    it 'diffoutput', ->
+    it 'output to different output functions using same logger', ->
       logObj.info "testloginfo"
       infoLog = sample
       output2 = ""
@@ -140,13 +143,13 @@
     describe '.logwarning', ->
       beforeEach ->
         logObj.setLogLevel logger.Warning
-      it 'empty', ->
+      it 'empty cases due to log level', ->
         logObj.debug "testlogdebug"
         assert.equal sample, ""

         logObj.info "testloginfo"
         assert.equal sample, ""
-      it 'notempty', ->
+      it 'not empty cases due to log level', ->
         logObj.warn "testlogwarning"
         assert.notDeepEqual JSON.parse(sample), ""

@@ -158,7 +161,7 @@
     describe '.logcritical', ->
       beforeEach ->
         logObj.setLogLevel logger.Critical
-      it 'empty', ->
+      it 'empty cases due to log level', ->
         logObj.debug "testlogdebug"
         assert.equal sample, ""

@@ -170,12 +173,12 @@

         logObj.error "testlogerror"
         assert.equal sample, ""
-      it 'notempty', ->
+      it 'not empty cases due to log level', ->
         logObj.critical "testlogcritical"
         assert.notDeepEqual JSON.parse(sample), ""

   describe '.diffformat', ->
-    it 'diffformat', ->
+    it 'use a different formatter than KV', ->
       testFormatter = (data) -> "\"This is a test\""
       logObj.setFormatter testFormatter
       logObj.warn "testlogwarning"
@@ -184,14 +187,14 @@
   describe '.multipleloggers', ->
     before ->
       logObj2 = new logger("logger-tester2")
-    it 'samebuffer', ->
+    it 'log to same output buffer', ->
       logObj2.setOutput outputFunc
       logObj.warn "testlogwarning"
       output1 = sample
       logObj2.info "testloginfo"
       assert.notDeepEqual JSON.parse(sample), JSON.parse(output1)

-    it 'diffbuffer', ->
+    it 'log to different output buffer', ->
       output2 = ""
       outputFunc2 = (text) -> output2 = text
       logObj2.setOutput outputFunc2


Remove selection when added a discussion

--- app/js/jail_iframe/util/create.coffee
+++ app/js/jail_iframe/util/create.coffee
@@ -1,5 +1,6 @@
 FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
   success = ->
+    window.document.getSelection().removeAllRanges()
     FactlinkJailRoot.createButton.hide()
     FactlinkJailRoot.off 'modalOpened', success


GUI support for market API changes #313

GUI support for market API changes #313

--- app/js/services/market_service.coffee
+++ app/js/services/market_service.coffee
@@ -518,7 +518,8 @@
         #console.log " ---- pull_orders"
         @wallet_api.market_order_list(market.asset_base_symbol, market.asset_quantity_symbol, 100, account_name).then (results) =>
             for r in results
-                td = @helper.order_to_trade_data(r, market.base_asset, market.quantity_asset, inverted, inverted, inverted)
+                td = @helper.order_to_trade_data(r[1], market.base_asset, market.quantity_asset, inverted, inverted, inverted)
+                td.id = r[0]
                 #console.log("------ market_order_list ------>", r, td) if r.type == "cover_order"
                 td.status = "posted" if td.status != "cover"
                 continue if (td.type == "short_order" or td.type == "cover_order") and not market.margins_available


log: fix tests

log: fix tests

--- test/options/log.coffee
+++ test/options/log.coffee
@@ -20,7 +20,7 @@
         logs[0].level.should.eql 'INFO'
         logs[0].message.should.eql 'handler'
         (logs[0].module is undefined).should.be.true()
-        logs[0].time.should.match /\d+/
+        logs[0].time.should.be.a.Number()
         logs[0].total_depth.should.eql 1
         next err

@@ -37,7 +37,7 @@
         logs[0].level.should.eql 'INFO'
         logs[0].message.should.eql 'handler'
         (logs[0].module is undefined).should.be.true()
-        logs[0].time.should.match /\d+/
+        logs[0].time.should.be.a.Number()
         logs[0].total_depth.should.eql 2
         next err

@@ -58,7 +58,7 @@
         logs_child[0].level.should.eql 'INFO'
         logs_child[0].message.should.eql 'handler'
         (logs_child[0].module is undefined).should.be.true()
-        logs_child[0].time.should.match /\d+/
+        logs_child[0].time.should.be.a.Number()
         logs_child[0].total_depth.should.eql 2
         next err

@@ -106,7 +106,7 @@
         logs[0].level.should.eql 'INFO'
         logs[0].message.should.eql 'handler'
         (logs[0].module is undefined).should.be.true()
-        logs[0].time.should.match /\d+/
+        logs[0].time.should.be.a.Number()
         logs[0].total_depth.should.eql 1
         next err


wrap callback test in test.fail

wrap callback test in test.fail

--- test/parser.test.coffee
+++ test/parser.test.coffee
@@ -369,7 +369,7 @@
       # Make sure no future changes break this
       ++nCalled
       if nCalled > 1
-        throw new Error 'callback called multiple times'
+        test.fail 'callback called multiple times'
       # SAX Parser throws multiple errors when processing async. We need to catch and return the first error
       # and then squelch the rest. The only way to test this is to defer the test finish call until after the
       # current stack processes, which, if the test would fail, would contain and throw the additional errors


Added new start syntax

Added new start syntax

--- src/pairbot.coffee
+++ src/pairbot.coffee
@@ -32,6 +32,7 @@
         'pairing with'
         'start pairing with'
         'start with'
+        'i\'m pairing with'
     ].join('|')
     stop: [
         'spw'


Basic score validation

Basic score validation

--- src/reducers/round.coffee
+++ src/reducers/round.coffee
@@ -8,6 +8,8 @@
   switch action.type
     when SCORE
       # TODO: Add correct scoring validation logic
+      scoreCount = state.get('rounds').last().get('scores').count()
+      return state if scoreCount >= 3
       state.updateIn ['rounds', -1, 'scores'], (scores) ->
         newScore = Immutable.fromJS {points: action.points, multiplier: action.multiplier}
         scores.push newScore


Fix error on inviting already joined users, fixes #790.

--- packages/rocketchat-slashcommands-invite/invite.coffee
+++ packages/rocketchat-slashcommands-invite/invite.coffee
@@ -24,6 +24,12 @@
 			if not user?
 				return

+			# verify the user isn't already in this room
+			room = ChatRoom.findOne({ _id: item.rid, usernames: { $nin: [ user.username ]} })
+
+			if not room?
+				return
+
 			Meteor.runAsUser user._id, ->
 				Meteor.call 'joinRoom', item.rid


Remove temporary variable per PR feedback

--- test/test_helper.coffee
+++ test/test_helper.coffee
@@ -66,8 +66,7 @@
     return no if first_index is -1

     for value, value_index in consecutive_values
-      index = first_index + value_index
-      return no if array[index] isnt value
+      return no if array[first_index + value_index] isnt value

     return yes


trying something.

trying something.

--- src/scripts/sifter.coffee
+++ src/scripts/sifter.coffee
@@ -59,8 +59,9 @@
           @project = new Project(project, msg)
           @project.get_all_change_requests_qa(msg)

-   robot.respond /(message room)/i, (msg) ->
-     robot.messageRoom "Hi"
+   setInterval ->
+     console.log robot.room
+   , 1000

 class Project
   constructor: (project, msg) ->


Really long proposal descriptions should get shortened on the homepage when using "proposal_show_description_on_homepage"

--- @client/collapsed_proposal.coffee
+++ @client/collapsed_proposal.coffee
@@ -198,12 +198,16 @@
             proposal.name

           if customization('proposal_show_description_on_homepage', null, subdomain)
+            if proposal.description?.length > 700
+              desc = proposal.description(0,700) + " (...)" # this might cause weird HTML formatting issues
+            else
+              desc = proposal.description
             DIV
               style:
                 fontSize: 14
                 color: '#444'
                 marginBottom: 4
-              dangerouslySetInnerHTML: __html: proposal.description
+              dangerouslySetInnerHTML: __html: desc

           DIV
             style:


fix refresh of playlists

fix refresh of playlists

--- core/plugmixer.coffee
+++ core/plugmixer.coffee
@@ -3,7 +3,7 @@

 'use strict'

-VERSION = "2.0.0"
+VERSION = "2.0.1"

 class Plugmixer
   INITIALIZATION_TIMEOUT = 512
@@ -159,6 +159,8 @@
       API.on API.ROOM_CHANGE, (oldRoom, newRoom) ->
         Room.changedTo newRoom

+      Helper.PlaylistRefresh.initialize()
+

   ###
   # Miscellaneous features.
@@ -168,6 +170,11 @@
       TITLE_TEXT = '#now-playing-media .bar-value'
       @update: ->
         $(TITLE_TEXT).attr 'title', $(TITLE_TEXT).text() # Hover text.
+
+    @PlaylistRefresh: class PlaylistRefresh
+      @initialize: ->
+        $(document).on 'click', '#footer',  (event) ->
+          Playlists.refreshIfRequired()

   ###
@@ -218,7 +225,19 @@
         return playlist.isActive()
       )[0]

+    @refreshIfRequired = ->
+      refresh = false
+      for playlist in playlists
+        # Refresh if any of the playlists no longer have a dom parent.
+        if playlist.dom.parent().length == 0 then refresh = true
+
+      if refresh
+        playlistNames = @getEnabled().map (playlist) -> return playlist.name
+        @initialize()
+        @update(playlistNames)
+
     @update: (playlistNames) ->
+      @refreshIfRequired()
       playlists.forEach (playlist) ->
         enable = false
         for playlistName in playlistNames
@@ -234,11 +253,12 @@

     @activateRandom: ->
       return if Room.active != 1 # Do nothing if not active.
-      playlist = @getRandom()
+      @refreshIfRequired()
+      playlist = getRandom()
       activePlaylist = playlist
       if playlist? then playlist.activate()

-    @getRandom = ->
+    getRandom = =>
       countSum = 0
       activePlaylists = @getEnabled()
       for playlist in activePlaylists


fix callbacks on error

fix callbacks on error

--- src/server/session.coffee
+++ src/server/session.coffee
@@ -147,12 +147,14 @@
         if req.v
           # It says 'fetch' on the tin, but actually the client wants me to fetch some ops.
           agent.getOps collection, doc, req.v, -1, (err, results) ->
+            return callback err if err
             sendOp collection, doc, r for r in results
             callback null, {}

         else
           agent.fetch collection, doc, (err, data) ->
-            callback err, {data:{v:data.v, type:data.type, snapshot:data.data, meta:data.meta}}
+            return callback err if err
+            callback null, {data:{v:data.v, type:data.type, snapshot:data.data, meta:data.meta}}

       when 'sub'
         return callback null, error:'Already subscribed' if isSubscribed collection, doc


Adjust whitespace for cli

Adjust whitespace for cli

--- src/cli.coffee
+++ src/cli.coffee
@@ -10,11 +10,11 @@
     .description('Create an alias for a Harvest resource. Shortcut: a')
     .option('-t, --type <type>', 'specify the resource type for which to create an alias. Default: project')
     .action ->
-            type = switch cmd.type
-                when 'c' then 'client'
-                when 't' then 'task'
-                when 'p' then 'project'
-                else cmd.type
+        type = switch cmd.type
+            when 'c' then 'client'
+            when 't' then 'task'
+            when 'p' then 'project'
+            else cmd.type
         commands.alias cmd.args[0], cmd.args[1], type

 cmd.command('day [date]')


expose require.__modules for debugging

expose require.__modules for debugging

--- src/require.coffee
+++ src/require.coffee
@@ -88,3 +88,4 @@

 this.require.resolve   = resolve
 this.require.nameToUrl = (path) -> "#{path}.js"
+this.require.__modules = __modules


add check for string in _pull

add check for string in _pull

--- lib/models/_pull.coffee
+++ lib/models/_pull.coffee
@@ -14,6 +14,7 @@

 module.exports = (repo, {extraArgs}={}) ->
   if upstream = getUpstream(repo)
+    if typeof extraArgs is 'string' then extraArgs = [extraArgs]
     extraArgs ?= []
     # view = OutputViewManager.getView()
     startMessage = notifier.addInfo "Pulling...", dismissable: true


#494 flash only one instance at a given moment

--- lib/search-model.coffee
+++ lib/search-model.coffee
@@ -46,9 +46,9 @@
       if settings.get('flashOnSearch')
         @flashRange(@currentMatch)

-  flashMarkers = null
+  flashMarker = null
   flashRange: (range) ->
-    flashMarkers?.destroy()
+    flashMarker?.destroy()
     flashMarker = highlightRange @editor, range,
       class: 'vim-mode-plus-flash'
       timeout: settings.get('flashOnSearchDuration')


make sure to pass opts to Die.

make sure to pass opts to Die.

--- src/die.coffee
+++ src/die.coffee
@@ -77,6 +77,6 @@

   run: (func) ->
     @createServer func
-    require('./run')(@app)
+    require('./run')(@app)(@options)

 module.exports = Die


fix precedence

fix precedence

--- src/uapanfw.coffee
+++ src/uapanfw.coffee
@@ -72,7 +72,7 @@
     robot.logger.info logmsg

   robot.respond /fw(?: help|)$/, (msg) ->
-    cmds = []
+    cmds = ['```']
     arr = [
       modulename + " blacklist - show blacklist"
       modulename + " blacklist add (url|cidr) <url|cidr> - add to blacklist"
@@ -82,8 +82,9 @@
     for str in arr
       cmd = str.split " - "
       cmds.push "#{cmd[0]} - #{cmd[1]}"
-
-    msg.reply "```\n" + cmds.join "\n" + "\n```"
+    cmds.push '```'
+
+    msg.reply cmds.join "\n"

     logmsg = "#{modulename}: robot responded to #{msg.envelope.user.name}: " +
       "displayed #{modulename} help"
@@ -117,7 +118,7 @@
       #console.log obj
       arr.push sprintf fmt, obj.type, obj.val, expires.fromNow(), obj.creator

-    msg.reply "Blacklist items and expirations\n```\n"+ arr.join "\n" + "\n```"
+    msg.reply "Blacklist items and expirations\n```\n"+ arr.join("\n") + "\n```"

     logmsg = "#{modulename}: robot responded to #{msg.envelope.user.name}: " +
       "displayed blacklist items and expirations"
@@ -200,7 +201,7 @@

     usermsg = "Removed #{deltaN} entries from blacklist.  " +
       "Change will be applied in < 5 minutes.\n" +
-      "Removed: ```"+ arr.join "\n" + "```"
+      "Removed: ```"+ arr.join("\n") + "```"
     msg.reply usermsg

     logmsg = "#{modulename}: robot responded to #{msg.envelope.user.name}: " +


Check that package directory is git repo before using git to update

--- src/upgrade.coffee
+++ src/upgrade.coffee
@@ -71,6 +71,10 @@
         callback()
     else
       @loadInstalledAtomMetadata(callback)
+
+  folderIsRepo: (pack) ->
+    repoGitFolderPath = path.join(@atomPackagesDirectory, pack.name, '.git')
+    return fs.existsSync repoGitFolderPath

   getLatestVersion: (pack, callback) ->
     requestSettings =
@@ -109,7 +113,7 @@
       args = ['fetch', 'origin', 'master']
       git.addGitToEnv(process.env)
       @spawn command, args, {cwd: repoPath}, (code, stderr='', stdout='') ->
-        return callback(code) unless code is 0
+        return callback(new Error('Exit code: ' + code + ' - ' + stderr)) unless code is 0
         repo = Git.open(repoPath)
         sha = repo.getReferenceTarget(repo.getUpstreamBranch('refs/heads/master'))
         if sha isnt pack.apmInstallSource.sha
@@ -122,7 +126,7 @@

   getAvailableUpdates: (packages, callback) ->
     getLatestVersionOrSha = (pack, done) =>
-      if pack.apmInstallSource?.type is 'git'
+      if @folderIsRepo(pack) and pack.apmInstallSource?.type is 'git'
         @getLatestSha pack, (err, sha) ->
           done(err, {pack, sha})
       else


register-foreign: Error if there is no component or role specified

--- src/utils/register-foreign.coffee
+++ src/utils/register-foreign.coffee
@@ -32,8 +32,11 @@
     catch e
       return onError e

+    if not definition.component
+      return onError new Error ".component is not defined"
     definition.role = program.role if program.role
-    definition.role = path.basename defPath, path.extname defPath unless definition.role
+    if not definition.role
+      return onError new Error ".role is not defined for component #{definition.component}"
     definition.id = definition.role if not definition.id

     definition = foreigner.mapPorts definition


Update ldap_server.coffee

Update ldap_server.coffee

add a return undefined if ldap is not set, so other login methods, like password, can be used also.

--- ldap_server.coffee
+++ ldap_server.coffee
@@ -118,6 +118,7 @@

 Accounts.registerLoginHandler 'ldap', (request) ->
+  return undefined if !request.ldap
   console.log 'Setting up LDAP connection'
   if !Meteor.settings.ldap
     throw new Error('LDAP settings missing.')


Change podkicker store URL to free version

On request of the developer

--- src/coffee/clients.coffee
+++ src/coffee/clients.coffee
@@ -69,7 +69,7 @@
       title: 'Podkicker Pro'
       scheme: 'podkicker://subscribe/'
       icon: 'android/podkicker@2x.png'
-      install: 'https://play.google.com/store/apps/details?id=com.podkicker'
+      install: 'https://play.google.com/store/apps/details?id=ait.podka'
     },
     {
       title: 'uPod'


[options] allow drag and drop only with panel header

--- src/coffee/options.coffee
+++ src/coffee/options.coffee
@@ -226,12 +226,13 @@
                 .sortable {
                     axis: 'y'
                     containment: 'parent'
+                    handle: '.panel-heading'
                     cursor: '-webkit-grabbing'
                     distance: 5
                     revert: true
                     stop: onOrderChanged
                 }
-            $ '#source_list > ul'
+            $ '#source_list .panel-heading'
                 .disableSelection()

             reloadManifestErrors();


Fix a MIME typo

Fix a MIME typo

--- node-http-server.coffee
+++ node-http-server.coffee
@@ -6,7 +6,7 @@

 respond_js = (res, code, js) ->
-  _respond_text res, code, 'application/javascript', js
+  _respond_text res, code, 'text/javascript', js

 respond_json = (res, code, x) ->


return true if prefix.length is zero

return true if prefix.length is zero

--- lib/atom-ternjs-autocomplete.coffee
+++ lib/atom-ternjs-autocomplete.coffee
@@ -32,8 +32,7 @@
     isValidPrefix: (prefix) ->
         if prefix.length? > 1
             prefix = '_' + prefix
-        if prefix.replace(/\s/g, '').length is 0
-            prefix = '_'
+        return true if prefix.replace(/\s/g, '').length is 0
         try (new Function("var " + prefix))()
         catch e then return false
         return true


Fix #199 #200 #193

Fix #199 #200 #193

--- lib/services/php-file-parser.coffee
+++ lib/services/php-file-parser.coffee
@@ -386,6 +386,7 @@

         while line > 0
             lineText = editor.lineTextForBufferRow(line)
+            return unless lineText

             if line != position.row
                 i = (lineText.length - 1)


添加subview判断是否为view子类

添加subview判断是否为view子类

--- lib/utils/chameleon-box-view.coffee
+++ lib/utils/chameleon-box-view.coffee
@@ -49,10 +49,10 @@

     if typeof @options.subview is 'function'
       @contentView = new @options.subview()
-    else if typeof @options.subview is 'object'
+    else if typeof @options.subview is 'object' and @options.subview instanceof View
       @contentView = new @options.subview.constructor()
     else
-      @contentView = {};
+      @contentView = document.createElement('div');

     @contentView.parentView = @
     @contentBox.append(@contentView)


Renaming tests.

Renaming tests.

--- tests.coffee
+++ tests.coffee
@@ -67,7 +67,7 @@
 if Meteor.isClient
   Counts = new Meteor.Collection 'Counts'

-  testAsyncMulti 'meteor-related - basic', [
+  testAsyncMulti 'related - basic', [
     (test, expect) ->
       Meteor.subscribe 'users-posts', expect()
       Meteor.subscribe 'users-posts-count', expect()


Don't overwrite prop

Don't overwrite prop

--- src/index.cjsx
+++ src/index.cjsx
@@ -51,11 +51,11 @@

     # Tabs style
     if @state.active is "write"
-      writeStyle = objectAssign @props.tabStyle, @props.tabActiveStyle
+      writeStyle = objectAssign {}, @props.tabStyle, @props.tabActiveStyle
       previewStyle = @props.tabStyle
     else if @state.active is "preview"
       writeStyle = @props.tabStyle
-      previewStyle = objectAssign @props.tabStyle, @props.tabActiveStyle
+      previewStyle = objectAssign {}, @props.tabStyle, @props.tabActiveStyle

     # Are we writing or previewing?
     #


introducing new lookup method removing lookupscache

--- lib/Context.coffee
+++ lib/Context.coffee
@@ -2,12 +2,6 @@
 events = require 'events'

 ACTIONS = ['configured', 'booted', 'started', 'running', 'shutdown', 'stopped']
-
-## EXPERIMENTAL identity based lookups cache -> nero
-## it is working! still deactivated by default. to use
-## put USELOOKUPSCACHE: true into the base config object
-USELOOKUPSCACHE = false
-LOOKUPSCACHE = {}

 module.exports =

@@ -68,14 +62,6 @@

             @_emitter = @_createEmitter config

-            # --> EXPERIMENTAL identity based lookups cache -> nero
-
-            if config.USELOOKUPSCACHE
-                USELOOKUPSCACHE = true
-                @logger.debug 'init lookups cache'
-
-            # <-- EXPERIMENTAL
-
             @children = new floyd.data.MappedCollection()

             @_changeStatus 'configured'
@@ -404,9 +390,14 @@
                 done: (err)=>

                     if !__first && ( __first = true )
-                        @_changeStatus? status
-                        done?()
-
+                        if level is 'stop' || level is 'destroy'
+                            @_changeStatus? status
+                            done?()
+
+                        else
+                            done?()
+                            @_changeStatus? status
+
                     else if err
                         done? err

@@ -449,210 +440,45 @@
         ##
         stop: (done)->
             @_changeStatus 'shutdown'
-
-            # --> EXPERIMENTAL identity based lookups cache -> nero
-
-            if USELOOKUPSCACHE
-                for ident in floyd.tools.objects.keys LOOKUPSCACHE
-                    LOOKUPSCACHE[ident]._off()
-                    delete LOOKUPSCACHE[ident]
-
-            # <-- EXPERIMENTAL
-
+
             @_init 'stop', 'stopped', done

-
-        ##
-        ## TODO description
-        ##
+        ##
+        ##
         ##
         lookup: (name, identity, done)->
-
-            if !(__ident = identity.id) || !identity.token
-                console.log '2. parameter is not identity', @ID
-                throw new Error '2. parameter is not identity'
-
-            _children = 0
-            _parent = !!(@parent && @parent.lookup)
-            _global = !!(!@parent && floyd.__parent?.lookup)
-
-            @logger.debug 'lookup:', name, __ident
-
-            # --> EXPERIMENTAL identity based lookups cache -> nero
-
-            if USELOOKUPSCACHE # inactive if false here
-
-                ## interrupt search here and return lookup from cache
-
-                if (lookupscache = LOOKUPSCACHE[__ident]) && lookupscache[name]
-                    @logger.debug 'found cached:', name, identity.id
-                    return done(null, lookupscache[name])
-
-            # <-- EXPERIMENTAL
-
-
-            @logger.debug 'start search', name, identity.id
-
-            n=0
-
-            found = false
-
-            __found = ()=>
-                found = true
-
-            __check = ()=>
-                return found
-
-            _try = (err, ctx)=>
-                #@logger.debug found, '_try', ctx?.ID, identity.id
-
-                if !__check()
-
-                    if ctx
-
-                        # --> EXPERIMENTAL identity based lookups cache -> nero
-
-                        if USELOOKUPSCACHE # inactive if false here
-                            if !(lookupscache = LOOKUPSCACHE[__ident])
-                                @logger.debug 'create lookups cache for', __ident
-
-                                lookupscache = LOOKUPSCACHE[__ident] = {}
-
-                                identity.on 'destroyed', _destroy = ()=>
-                                    @logger.debug 'destroy lookups cache for', __ident
-                                    delete LOOKUPSCACHE[__ident]
-
-                                lookupscache._off = ()->
-                                    identity.off 'destroyed', _destroy
-
-                            if !lookupscache[name]
-                                @logger.debug 'add %s to cache for', name, __ident
-
-                                lookupscache[name] = ctx
-
-                                ctx.on 'destroyed', ()=>
-                                    @logger.debug 'delete %s from cache for', name, __ident
-                                    delete lookupscache[name]
-
-                        # <-- EXERIMENTAL
-
-                        __found()
-
-                        #@logger.debug __check(), n++, 'found', ctx.ID, identity.id
-                        done null, ctx
-
-                    else if !err
-                        #console.log 'next'
-                        next()
-
-                    else
-                        done err
-
-                else if !err
-                    console.warn 'double found for lookup:', name, identity.id
-
-                else
-                    console.error err
-
-            ##
-            ## recursive function calls it's self until a notfound error is thrown
-            next = ()=>
-
-                if !__check()
-
-                    ##
-                    ## search children
-                    ##
-                    if child = @children[_children++]
-                        id = child.id
-
-                        if !__check()
-                            @logger.fine 'test child', id
-
-                            # 1. the requested context is a direct child.
-                            if name is id
-
-                                @logger.debug 'found as a direct child', child.id
-
-                                #console.log @ID, name
-                                child.forIdentity identity, _try
-
-                            # 2. the prefix of name matches child.id
-                            else if name.substr(0, name.indexOf '.') is id
-
-                                @logger.debug 'searching for %s in %s', name.substr(id.length+1), child.ID
-
-                                child.lookup name.substr(id.length+1), identity, _try
-
-                            else
-                                next()
-
-                    ##
-                    ## self lookup
-                    ##
-                    else if name is @id
-
-                        # 4. last but not least it happens that
-                        # someone asks us about our self...
-
-                        @logger.debug 'its my self', name, @ID
-
-                        @forIdentity identity, _try
-
-
-                    ##
-                    ##
-                    ##
-                    else if name.substr(0, name.indexOf '.') is @id
-
-                        @lookup name.substr(@id.length + 1), identity, _try
-
-
-                    ##
-                    ## search parent
-                    ##
-                    else if _parent
-                        _parent = false
-
-                        # 3. if we still did not found anything we
-                        # delegate that to the parent
-
-                        @logger.debug 'delegate to parent', @parent.ID, name
-
-                        process.nextTick ()=>
-                            @parent.lookup name, identity, _try
-
-
-                    ##
-                    ## global parent
-                    ##
-                    else if _global
-                        _global = false
-
-                        # 5. EXPERIMENTAL
-
-                        @logger.debug 'maybe its global', @ID, name, floyd.__parent
-
-                        floyd.__parent.lookup name, identity, _try
-
-
-                    ##
-                    ## not found
-                    ##
-                    else
-
-                        err = new Error('Context not found: '+name)
-
-                        if done
-                            done err
-                        else
-                            throw err
-
-
-            ## start recursion
-            next()
-
+            if !identity || !identity.id || !identity.token
+                return done new Error '2. parameter is not identity'
+
+            ## myself
+            if name is @id
+                @logger.debug 'found(%s) for %s', @ID, identity.id
+                return @forIdentity identity, done
+
+            ## children
+            if (base = name.split('.').shift()) is @id
+                base = (name = name.substr base.length + 1).split('.').shift()
+
+            for child in @children
+                if child.id is base
+                    @logger.debug 'delegate lookup(%s) to child %s for %s', name, child.ID, identity.id
+                    return child.lookup name, identity, done
+
+            ## parent
+            if @parent?.lookup
+                @logger.debug 'delegate lookup(%s) to parent %s for %s', name, @parent.ID, identity.id
+                return @parent.lookup name, identity, done
+
+            ## global
+            if floyd.__parent?.lookup
+                @logger.debug 'delegate lookup(%s) to global parent for %s', name, identity.id
+                return floyd.__parent.lookup name, identity, done
+
+            ## not found
+            @logger.debug 'lookup(%s) failed for %s', name, identity.id
+            done new Error 'Context not found: '+name
+

         ##
         ## delegates a method call down the hirarchy
@@ -816,7 +642,7 @@
                 ## all non served events are boubled up if @data.events?.delegate is true
                 ## or if @data.events?.delegate is an array that contains action as a string
                 ## delegation is always suppressed for lifecycle-events
-                if !stop && (@data.events?.delegate is true || @data.events?.delegate?.indexOf action) && ACTIONS.indexOf(action) is -1
+                if !stop && ACTIONS.indexOf(action) is -1 && (@data.events?.delegate is true || @data.events?.delegate?.indexOf(action) > -1)

                     @parent._emit action, event, args


Revert "fix #8"

Revert "fix #8"

This reverts commit 9be72bae2c6352bd2b64e6a55754859c461a220f.

--- lib/sublime-tabs.coffee
+++ lib/sublime-tabs.coffee
@@ -58,6 +58,7 @@
     tabBarView.remove() for tabBarView in @tabBarViews ? []

     # tree view
+    SublimeTree.deactivate()
     @treeView?.deactivate()
     @treeView = null


Save packet with gzip compression

Save packet with gzip compression

--- lib/appdata.coffee
+++ lib/appdata.coffee
@@ -3,12 +3,11 @@
 fs = require 'fs-extra'
 glob = require 'glob'
 path = require 'path-extra'
+zlib = require 'zlib'

 # constant
 window.APPDATA = path.join(window.APPDATA_PATH, 'battle-detail')
 REFRESH_INTERVAL = 60000
-FS_RW_OPTIONS =
-  encoding: 'UTF-8'

 # init
 fs.ensureDir APPDATA, (error) ->
@@ -22,6 +21,7 @@
     # Use timestamp as id
     # from oldest to newest
     @packetList = []
+    @packetFile = {}
     @packetListLastRefresh = 0

   # Packet Management
@@ -38,10 +38,18 @@

   savePacketSync: (id, packet) ->
     return unless id? and packet?
-    file = path.join(APPDATA, "#{id}.json")
-    data = JSON.stringify(packet)
-    fs.writeFileSync(file, data, FS_RW_OPTIONS)
-    @packetList.push(id)
+    try
+      name = "#{id}.json.gz"
+      fpath = path.join(APPDATA, name)
+      data = zlib.gzipSync(JSON.stringify(packet))
+      fs.writeFileSync(fpath, data)
+
+      @packetList.push(id)
+      @packetFile[id] =
+        name: name
+        packet: packet
+    catch error
+      console.error error

   loadPacket: (id, callback) ->
     return unless id? and callback?
@@ -52,13 +60,20 @@
   loadPacketSync: (id) ->
     return unless id?
     try
-      file = path.join(APPDATA, "#{id}.json")
-      data = fs.readFileSync(file, FS_RW_OPTIONS)
+      file = @packetFile[id]
+      return null if not file?
+      return file.packet if file.packet?
+
+      fpath = path.join(APPDATA, file.name)
+      data = fs.readFileSync(fpath)
+      if path.parse(file.name).ext == '.gz'
+        data = zlib.unzipSync(data).toString()
+
       packet = JSON.parse(data)
+      file.packet = packet
       return packet
     catch error
       console.error error
-      return null

   searchPacket: (start, end) ->
     return unless start? and end? and start <= end
@@ -77,8 +92,17 @@
   _refreshPacketSync: ->
     return unless (Date.now() - @packetListLastRefresh) > REFRESH_INTERVAL
     # list = fs.readdirSync APPDATA
-    list = glob.sync path.join(APPDATA, "*.json")
-    list = list.map (p) -> parseInt path.parse(p).name
+    list = []
+    list = list.concat(glob.sync(path.join(APPDATA, "*.json")))
+    list = list.concat(glob.sync(path.join(APPDATA, "*.json.gz")))
+    list = list.map (p) =>
+      pp = path.parse(p)
+      name = pp.base
+      id = parseInt(name.slice(0, name.indexOf('.')))
+      @packetFile[id] ?=
+        name: name
+        packet: null
+      return id
     list.sort()
     @packetListLastRefresh = Date.now()
     @packetList = list


refactored ROOT variable for emai utils to be more clear and point to correct places

--- utils.coffee
+++ utils.coffee
@@ -20,20 +20,21 @@
 isDevEnv = ->
   process.env.NODE_ENV == 'development'

+deployedMeteorBundleDir = ->
+  meteor_root = fs.realpathSync( process.cwd() + '/../' )
+  fs.realpathSync( meteor_root + '/../' )
+
 developmentPrivateDir = ->
-  return unless isDevEnv()
   # In development, using pwd is fine. Remove the .meteor/foo/bar stuff though.
   meteor_root = process.cwd().replace(/(\.meteor.*)/g, '')
   path.join(meteor_root, 'private')

 productionPrivateDir = ->
-  return if isDevEnv()
-  meteor_root = fs.realpathSync( process.cwd() + '/../' )
-  fs.realpathSync( meteor_root + '/../' )
+  bundle_path = process.env.BUNDLE_PATH || process.env.APP_DIR || deployedMeteorBundleDir()
+  path.join(bundle_path, 'programs', 'server', 'assets', 'app')

-privateDir = process.env.BUNDLE_PATH || process.env.APP_DIR || productionPrivateDir()
-ROOT       = privateDir && path.join(privateDir, 'programs', 'server', 'assets', 'app')
-ROOT     ||= developmentPrivateDir()
+# ROOT is private directory
+ROOT = if isDevEnv() then developmentPrivateDir() else productionPrivateDir()

 Utils =


Ensure versions are loaded before going into the agent creation wizard

--- fmc/fmc-webui/src/main/webapp/app/controllers/agents_page.coffee
+++ fmc/fmc-webui/src/main/webapp/app/controllers/agents_page.coffee
@@ -21,14 +21,14 @@
   "controllers/profile_list_control"
   "controllers/add_agent_wizard"
   "controllers/migrate_container_page"
-  "controllers/jvm_metrics"
   "controllers/add_profile_dialog"
   "controllers/controls/collection"
   "controllers/controls/composite"
   "controllers/controls/table"
   "controllers/controls/editable_property"
   "controllers/controls/swappable_model_view"
-], (app, jade, Agents, ProfileList, AddAgentWizard, MigrateContainerPage, JVMMetrics) ->
+  "controllers/controls/loading_page"
+], (app, jade, Agents, ProfileList, AddAgentWizard, MigrateContainerPage) ->

   class AgentOverview extends FON.SwappableModelView
@@ -328,10 +328,13 @@
       false

     do_add: (event) ->
-      app.page new AddAgentWizard
-        model: @model
-        do_return: =>
-          @reset()
+      app.page new FON.LoadingPage
+      app.versions.fetch
+        success: =>
+          app.page new AddAgentWizard
+            model: @model
+            do_return: =>
+              @reset()
       false

     on_render: ->


Don't assume default variant in JS. Let this be controlled by HTML markup.

Fixes #4849

--- frontend/app/assets/javascripts/spree/frontend/product.js.coffee
+++ frontend/app/assets/javascripts/spree/frontend/product.js.coffee
@@ -37,8 +37,9 @@
   radios = ($ '#product-variants input[type="radio"]')

   if radios.length > 0
-    Spree.showVariantImages ($ '#product-variants input[type="radio"]').eq(0).attr('value')
-    Spree.updateVariantPrice radios.first()
+    selectedRadio = ($ '#product-variants input[type="radio"][checked="checked"]')
+    Spree.showVariantImages selectedRadio.attr('value')
+    Spree.updateVariantPrice selectedRadio

   Spree.addImageHandlers()


Bug fix: GA reporting for survey

Bug fix: GA reporting for survey

--- _includes/coffeescripts/survey.coffee
+++ _includes/coffeescripts/survey.coffee
@@ -42,16 +42,18 @@
       pushToGA = (values) ->
         $.each values, ->
           _gaq.push [
-            '_trackEvent',
+            '_trackEvent'
             # GA "Event Category"
-            surveyName,
+            surveyName
             # GA "Event Action"
-            @.name,
+            @.name
             # GA "Event label"
-            @.value,
+            @.value
             # GA "Event Value", if integer
-            parseInt(@.value, 10) is if @.value then parseInt(@.value, 10) else 0
+            (if parseInt(@value, 10) is @value then parseInt(@value, 10) else 0)
           ]
+          return
+        return

       # Collect data from survey form
       collectFormData = (formValues) ->


remove block.coffee #814

remove block.coffee #814

--- src/Ojs/SiteBundle/Resources/public/js/block.coffee
+++ src/Ojs/SiteBundle/Resources/public/js/block.coffee
@@ -1,29 +0,0 @@
-$(document).ready ->
-  $(".blocklink_order_updater").on 'change', ->
-    value = $(this).val()
-    id = $(this).data('link-id')
-    field = $(this)
-    $.ajax
-      url: Routing.generate('ojs_block_link_order', {id: id, value: value})
-      type: 'POST'
-      dataType: 'json'
-      success: (rd)->
-        if rd.status
-          document.location.reload()
-          return false
-
-    return false;
-  $(".block_order_updater").on 'change', ->
-    value = $(this).val()
-    id = $(this).data('block-id')
-    field = $(this)
-    $.ajax
-      url: "/block/order/#{id}/#{value}"
-      type: 'POST'
-      dataType: 'json'
-      success: (rd)->
-        if rd.status
-          document.location.reload()
-          return false
-
-    return false;


add ageBracket for leaderboard-my-row (#6546)

Co-authored-by: smallst_wsl <6c42689ff77371401bf43b7d56b93ac1ca3e92d3@163.com>

--- app/views/ladder/LadderTabView.coffee
+++ app/views/ladder/LadderTabView.coffee
@@ -439,6 +439,9 @@
     above = @playersAbove.models
     l = l.concat(above)
     l.reverse()
+    if @session?.get('creatorAge') and !(@session?.get('ageBracket'))
+      # add ageBracket for @session
+      @session.set('ageBracket', utils.ageToBracket(@session.get('creatorAge')))
     l.push @session
     l = l.concat(@playersBelow.models)
     if @myRank is 'unknown'


add alert in order to debug

add alert in order to debug

--- app/views/pv_queries/create.js.coffee
+++ app/views/pv_queries/create.js.coffee
@@ -13,6 +13,7 @@
     data.addColumn('number', 'kW')

     if $("#output_pa").length
+      alert 'output has length'
       dni_string = $("#output_pa").data("datapoints")
       dni_array = dni_string.split(" ").map(parseFloat)
       for month in [1..12]


Hook up events for turbo links

Hook up events for turbo links

--- app/assets/javascripts/items.coffee
+++ app/assets/javascripts/items.coffee
@@ -1,5 +1,14 @@
-$ ->
+setEvents = () ->
   $("#submitItem").on "click", ->
     $("#itemForm").submit()
+
   $("#submitCategory").on "click", ->
     $("#categoryForm").submit()
+
+$ ->
+  setEvents()
+
+# For turbo-links
+$(document).on "page:load", ->
+  setEvents()
+


Tidy the CoffeeScript

Tidy the CoffeeScript

--- app/assets/javascripts/posts.coffee
+++ app/assets/javascripts/posts.coffee
@@ -35,7 +35,7 @@
   m_app.init({
     canvas_container_id: "b4w-overlay",
     callback: init_cb
-})
+  })

 init_cb = ->
   m_data.load("/all-floors.json", load_cb)


Add regex guard to password fields

Add regex guard to password fields

--- app/assets/javascripts/users.coffee
+++ app/assets/javascripts/users.coffee
@@ -38,3 +38,6 @@
   removeOrgRows $table
   rezebra $table
   addOrgRows $table
+
+$(document).on "page:change", ->
+  $.guard("#user-password, #user-password-confirmation").using("regex", /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,72}$/).message("Password must contain one uppercase, one lowercase and one number and be atlease 8 characters long.")


Add akusiro count

Add akusiro count

--- hubot/scripts/akusiro.coffee
+++ hubot/scripts/akusiro.coffee
@@ -10,10 +10,13 @@
     user = msg.match[1] or 'imai'
     min = msg.match[2]
     count = msg.match[3] or 3
-    msg.send "@#{user} あくしろ"
+    repeat = 0
     if min?
+      msg.send "<@#{user}|#{user}> あくしろ (0/#{count})"
       f = () ->
-        msg.send "@#{user} まだか"
-        if --count <= 0
+        msg.send "<@#{user}|#{user}> まだか (#{++repeat}/#{count})"
+        if repeat >= count
           clearInterval id
       id = setInterval f, min * 60000
+    else
+      msg.send "<@#{user}|#{user}> あくしろ"


Fix a cache bug

Fix a cache bug

--- app/coffee/services/resource.coffee
+++ app/coffee/services/resource.coffee
@@ -13,7 +13,8 @@
 # limitations under the License.

 ResourceProvider = ($http, $q, $gmStorage, $gmUrls, $model, config, $rootScope,
-                    $i18next, $filter, $log) ->
+                    $i18next, $filter, $log, $cacheFactory) ->
+    cache = $cacheFactory("httpCache", 512)
     service = {}
     headers = (diablePagination=true) ->
         data = {}
@@ -232,7 +233,7 @@
         ]

         key = _.map(args, (it) -> if it == undefined then "" else it).join(":")
-        return queryRaw("resolver", null, params, {cache:true})
+        return queryRaw("resolver", null, params, {cache:cache})

     # Get a site
     service.getSite = -> queryOne('sites')
@@ -252,7 +253,7 @@

     # Get a project
     service.getProject = (projectId) ->
-        return queryOne("projects", projectId, {cache:true})
+        return queryOne("projects", projectId, {cache:cache})

     # Get a project stats
     service.getProjectStats = (projectId) ->
@@ -276,7 +277,7 @@

     # Get roles
     service.getRoles = (projectId) ->
-        return queryMany('roles', {project: projectId}, {cache:true})
+        return queryMany('roles', {project: projectId}, {cache:cache})

     # Create role
     service.createRole = (projectId, role) ->
@@ -408,7 +409,7 @@
             "headers": headers()
             "url": $gmUrls.api("search")
             "params": {"project": projectId, "text": term, "get_all": getAll or false}
-            "cache": true
+            "cache": false
         }

         promise = $http(params)
@@ -815,7 +816,7 @@

     service.getIssueTypes = (projectId, filters={}) ->
         parameters = _.extend({}, filters, {project:projectId})
-        return queryMany("choices/issue-types", parameters, {cache:true})
+        return queryMany("choices/issue-types", parameters, {cache:false})

     service.createIssueType = (form) ->
         return $model.create("choices/issue-types", form)
@@ -829,7 +830,7 @@

     service.getPriorities = (projectId, filters={}) ->
         parameters = _.extend({}, filters, {project:projectId})
-        return queryMany("choices/priorities", parameters, {cache:true})
+        return queryMany("choices/priorities", parameters, {cache:false})

     service.createPriority = (form) ->
         return $model.create("choices/priorities", form)
@@ -858,10 +859,6 @@
     return service

-init = ($cacheFactory, $http) ->
-    $http.defaults.cache = $cacheFactory("httpCache", 512);
-
 module = angular.module('taiga.services.resource', ['taiga.config'])
-module.run(["$cacheFactory", "$http", init])
 module.factory('resource', ['$http', '$q', '$gmStorage', '$gmUrls', '$model', 'config', '$rootScope',
-                            '$i18next', '$filter', '$log', ResourceProvider])
+                            '$i18next', '$filter', '$log', "$cacheFactory", ResourceProvider])


small text change in help dialog

small text change in help dialog

fixes second item in 5741 fixes #5741

Change-Id: I7d0b882c769cb211d497df1f0a119fb7e46df604
Reviewed-on: https://gerrit.instructure.com/10080
Reviewed-by: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
Tested-by: Hudson <dfb64870173313a9a7b56f814c8e3b33e268497a@instructure.com>

--- app/coffeescripts/helpDialog.coffee
+++ app/coffeescripts/helpDialog.coffee
@@ -20,7 +20,7 @@
     defaultLinks: [
       {
         available_to: ['student']
-        text: I18n.t 'instructor_question', 'Ask your instructor a question'
+        text: I18n.t 'instructor_question', 'Ask Your Instructor a Question'
         subtext: I18n.t 'instructor_question_sub', 'Questions are submitted to your instructor'
         url: '#teacher_feedback'
       },
@@ -32,7 +32,7 @@
       },
       {
         available_to: ['user', 'student', 'teacher', 'admin']
-        text: I18n.t 'report_problem', 'Report a problem'
+        text: I18n.t 'report_problem', 'Report a Problem'
         subtext: I18n.t 'report_problem_sub', 'If Canvas misbehaves, tell us about it'
         url: '#create_ticket'
       }


neo4j: disable duplicate entry checker temporarily

--- client/landing/app/Applications/Activity.kdapplication/activitylistcontroller.coffee
+++ client/landing/app/Applications/Activity.kdapplication/activitylistcontroller.coffee
@@ -216,12 +216,13 @@
   addItem:(activity, index, animation) ->
     dataId = activity.getId?()

-    if dataId?
-      if @itemsIndexed[dataId]
-        log "duplicate entry", activity.bongo_?.constructorName, dataId
-      else
-        @itemsIndexed[dataId] = activity
-        super(activity, index, animation)
+    #if dataId?
+      #if @itemsIndexed[dataId]
+        #log "duplicate entry", activity.bongo_?.constructorName, dataId
+      #else
+        #@itemsIndexed[dataId] = activity
+
+    super(activity, index, animation)

   ownActivityArrived:(activity)->


updating chapter section to be able to handle chapters with no sections

--- src/components/task-plan/chapter-section.cjsx
+++ src/components/task-plan/chapter-section.cjsx
@@ -5,7 +5,10 @@
   propTypes:
     section: React.PropTypes.array.isRequired
   render: ->
-
-      {@props.section[0]}.{@props.section[1]}
+    chapter = @props.section[0]
+    if @props.section.length is 2
+      section = ".#{@props.section[1]}"
+
+      {chapter}{section}


Fix userId

Fix userId

--- lib/metrics.coffee
+++ lib/metrics.coffee
@@ -1,10 +1,8 @@
 Guid = require 'guid'

 module.exports =
-  configDefaults:
-    userId: Guid.raw()
-
   activate: ({sessionLength}) ->
+    atom.config.set('metrics.userId', Guid.raw()) unless atom.config.get('metrics.userId')
     @sessionStart = Date.now()
     process.nextTick ->
       Reporter = require './reporter'


Use nodeify instead of calling done() directly to account for promise rejection

--- tests/write.spec.coffee
+++ tests/write.spec.coffee
@@ -46,7 +46,8 @@
 							contents = contents.replace(/\0/g, '')

 							m.chai.expect(contents).to.equal('Lorem ipsum dolor sit amet')
-							done()
+
+						.nodeify(done)

 				describe 'given an error when writing the stream', ->


Adjust the char width ratio due to the latest scaling changes

--- lib/minimap.coffee
+++ lib/minimap.coffee
@@ -141,7 +141,7 @@
   # Public: Returns the char width ratio of the minimap compared to the real
   # editor. **The value is currently hard-coded until we find a good way to
   # compute it from the editor state**.
-  getCharWidthRatio: -> 0.72
+  getCharWidthRatio: -> 0.85

   # Internal: Toggles the minimap activation state.
   toggle: () ->


Fix spacing in motions.coffee

Fix spacing in motions.coffee

--- lib/motions.coffee
+++ lib/motions.coffee
@@ -159,7 +159,7 @@

   select: (count=1) ->
     {row, column} = @editor.getCursorBufferPosition()
-    @editor.setSelectedBufferRange(@selectRows(row, row+(count-1)))
+    @editor.setSelectedBufferRange(@selectRows(row, row + (count - 1)))

     _.times count, ->
       true


properly handle searching for tag by hashtag via navbar

--- manager/app/assets/javascripts/models/host.js.coffee
+++ manager/app/assets/javascripts/models/host.js.coffee
@@ -41,5 +41,5 @@
     url: ->
       s = "/hosts"
       if @query
-        s += "?q=" + @query
+        s += "?q=" + @query.replace(/#/, "%23")
       return s


Minor cleanup

Minor cleanup

--- app/scripts/lib/bounce/index.coffee
+++ app/scripts/lib/bounce/index.coffee
@@ -131,9 +131,10 @@
     style = document.createElement("dummy").style

     propertyLists = [
-      ["transform", "webkitTransform"],
+      ["transform", "webkitTransform"]
       ["animation", "webkitAnimation"]
     ]
+
     for propertyList in propertyLists
       propertyIsSupported = false
       for property in propertyList


Fixed the action stringify

Fixed the action stringify

--- roomtrol_web/src/scripts/views/action_configure.coffee
+++ roomtrol_web/src/scripts/views/action_configure.coffee
@@ -65,6 +65,8 @@
     this

   save: () ->
-    App.server.save_doc(App.actions.selected)
+    action = App.actions.selected.attributes
+    action["belongs_to"] = App.actions.selected.get("belongs_to").get("id")
+    App.server.save_doc(action)#App.actions.selected)

   cancel: () ->


Fix for reloaded page

Fix for reloaded page

--- app/assets/javascripts/ajax.js.coffee
+++ app/assets/javascripts/ajax.js.coffee
@@ -96,6 +96,7 @@
       # Re-configure javascript events
       $("#project-page-#{p_id} abbr.timeago").timeago();
       add_click_to_test_buttons()
+      add_tooltips()
       )


Modified in browser at pixie.strd6.com

Modified in browser at pixie.strd6.com

--- test/engine.coffee
+++ test/engine.coffee
@@ -183,6 +183,8 @@
 test "#setState", ->
   engine = Engine()

+  n
+
   engine.setState

 module()


Require a scenario before fetching custom curves

Ensures that a scenario ID is present prior to sending a request to
fetch data about custom curves.

Closes #3976

--- app/assets/javascripts/lib/app.coffee
+++ app/assets/javascripts/lib/app.coffee
@@ -226,16 +226,17 @@
       @customCurvesDeferred = $.Deferred()

       # Ajax request.
-      req = $.ajax(
-        url: App.scenario.url_path() +
-          '/custom_curves?include_internal=true&include_unattached=true'
-        method: 'GET'
-        dataType: 'json'
-      )
-
-      req.success((data) =>
-        @customCurvesDeferred.resolve(new CustomCurveCollection(data))
-      )
+      @api.ensure_id().done (id) =>
+        req = $.ajax(
+          url: App.scenario.url_path() +
+            '/custom_curves?include_internal=true&include_unattached=true'
+          method: 'GET'
+          dataType: 'json'
+        )
+
+        req.success((data) =>
+          @customCurvesDeferred.resolve(new CustomCurveCollection(data))
+        )

     return @customCurvesDeferred.promise()


Re-crop SVG on image load

Re-crop SVG on image load

--- app/classifier/subject-annotator.cjsx
+++ app/classifier/subject-annotator.cjsx
@@ -131,7 +131,7 @@
       {naturalWidth, naturalHeight} = e.target
       unless @state.naturalWidth is naturalWidth and @state.naturalHeight is naturalHeight
         @setState {naturalWidth, naturalHeight}, ->
-          # @refs.markingSurface.crop()
+          @refs.markingSurface.crop()
           @updateSize()

   handleFrameChange: (frame) ->


Close loader after loading US's in Kanban

--- app/coffee/modules/kanban/main.coffee
+++ app/coffee/modules/kanban/main.coffee
@@ -56,7 +56,8 @@
         "$tgStorage",
         "tgFilterRemoteStorageService",
         "tgProjectService",
-        "tgLightboxFactory"
+        "tgLightboxFactory",
+        "tgLoader"
     ]

     storeCustomFiltersName: 'kanban-custom-filters'
@@ -65,7 +66,7 @@
     constructor: (@scope, @rootscope, @repo, @confirm, @rs, @rs2, @params, @q, @location,
                   @appMetaService, @navUrls, @events, @analytics, @translate, @errorHandlingService,
                   @model, @kanbanUserstoriesService, @storage, @filterRemoteStorageService,
-                  @projectService, @lightboxFactory) ->
+                  @projectService, @lightboxFactory, @tgLoader) ->
         bindMethods(@)
         @kanbanUserstoriesService.reset()
         @.openFilter = false
@@ -271,6 +272,7 @@
             # We can't assure when this exactly happens so we need a defer
             scopeDefer @scope, =>
                 @scope.$broadcast("userstories:loaded", userstories)
+                @tgLoader.pageLoaded()

             return userstories