       return console.error e
 
 
-  # kd.singletons.socialapi.cacheable 'channel', id, (err, channel) ->
-
-  #   return routeToLatestWorkspace()  if err
-
-  #   try
-
-  #     [workspace] = globals.userWorkspaces.filter (w) -> w.channelId is channel.id
-
-  #     return routeToLatestWorkspace()  unless workspace
-
-  #     [machine] = globals.userMachines.filter (m) -> m.uid is workspace.machineUId
-
-  #     query = socialApiId: channel.creatorId
-  #     remote.api.JAccount.some query, {}, (err, account) =>
-
-  #       return throw new Error err  if err
-
-  #       username  = account.first.profile.nickname
-  #       channelId = channel.id
-
-  #       return loadIDE { machine, workspace, username, channelId }
-
-  #   catch e
-
-  #     console.error e
-  #     return routeToLatestWorkspace()
-
-
-# refreshWorkspaces = (callback) ->
-
-#   {mainView, computeController} = kd.singletons
-
-#   computeController.ready ->
-#     mainView.activitySidebar.fetchWorkspaces callback
-
-
 module.exports = -> lazyrouter.bind 'ide', (type, info, state, path, ctx) ->
 
   globals.userMachines = []

          if machine then routeToMachineWorkspace machine
          else routeToLatestWorkspace()

      # {machineLabel} = info.params
      # # we assume that if machineLabel is all numbers it is the channelId - SY
      # if /^[0-9]+$/.test machineLabel
      #   refreshWorkspaces -> loadCollaborativeIDE machineLabel
      # else if machine = getMachine machineLabel
      #   routeToMachineWorkspace machine
      # else
      #   routeToLatestWorkspace()


    when 'workspace'
      { params } = info
      params.username = username = nick()

      workspaceSlug = latestWorkspace.workspaceSlug

  kd.getSingleton('router').handleRoute "/IDE/#{machine.slug}/#{workspaceSlug}"


routeToLatestWorkspace = ->
