           publicLink.unreadCount.hide()
 
 
-  # workspacesFetched  = no
-  # fetchingWorkspaces = no
-
-  # fetchWorkspaces: do (callbackQueue = []) -> (callback = kd.noop) ->
-
-  #   activitySidebar = this
-
-  #   # return callback null, globals.userWorkspaces  if workspacesFetched
-  #   return callbackQueue.push callback       if fetchingWorkspaces
-
-  #   fetchingWorkspaces = yes
-
-  #   # put first callback to queue as well.
-  #   callbackQueue.push callback
-
-  #   remote.api.JWorkspace.fetchByMachines()
-
-  #     .then (workspaces) =>
-  #       fetchingWorkspaces = no
-
-  #       {socialapi} = kd.singletons
-
-  #       otherMachineUIds = []
-  #       myMachineUIds    = []
-
-  #       globals.userMachines.forEach (m) ->
-  #         if m.isMine() or m.isPermanent()
-  #         then myMachineUIds.push m.uid
-  #         else otherMachineUIds.push m.uid
-
-  #       otherWorkspaces  = workspaces.filter (ws) -> return ws.channelId and ws.machineUId in otherMachineUIds
-  #       myWorkspaces     = workspaces.filter (ws) -> return ws.machineUId in myMachineUIds
-
-  #       myChannels = []
-  #       queue      = []
-  #       otherWorkspaces.forEach (ws) ->
-  #         queue.push ->
-  #           socialapi.channel.byId id : ws.channelId, (err, channel) ->
-  #             myChannels.push channel.id  if channel
-  #             queue.fin()
-
-  #       sinkrow.dash queue, =>
-  #         workspacesIHaveAccess = otherWorkspaces.filter (ws) -> ws.channelId in myChannels
-  #         userWorkspaces        = myWorkspaces.concat workspacesIHaveAccess
-
-  #         globals.userMachines.forEach (machine) =>
-  #           return  unless machine.isMine()
-
-  #           for workspace in userWorkspaces \
-  #             when workspace and workspace.slug is 'my-workspace' \
-  #             and workspace.machineUId is machine.uid
-  #               return
-
-  #           userWorkspaces.push @getDummyWorkspace machine
-
-  #         globals.userWorkspaces  = userWorkspaces
-  #         # workspacesFetched     = yes
-  #         activitySidebar.updateMachineTree()
-
-  #         callbackQueue.forEach (fn) -> fn null, userWorkspaces
-  #         callbackQueue = []
-
-  #     .error (rest...) ->
-  #       fetchingWorkspaces = no
-  #       callbackQueue.forEach (fn) -> fn rest...
-  #       callbackQueue = []
-
-
-
-  # listMachines: (machines) ->
-
-    # treeData = []
-    # nickname = KD.nick()
-
-    # for machine in machines
-
-    #   treeData.push machine
-
-    #   unless machine.isPermanent()
-    #     treeData.push
-    #       title        : 'Workspaces'
-    #       type         : 'title'
-    #       parentId     : machine.getId()
-    #       id           : machine.getData().getId()
-    #       machineUId   : machine.uid
-    #       machineLabel : machine.slug or machine.label
-
-    #   ideRoute     = "/IDE/#{machine.slug or machine.label}/my-workspace"
-    #   machineOwner = machine.getOwner()
-    #   isMyMachine  = machine.isMine()
-    #   ideRoute     = "#{ideRoute}/#{machineOwner}"  unless isMyMachine
-    #   hasWorkspace = (KD.userWorkspaces.filter ({name, machineUId}) -> return name is 'My Workspace' and machineUId is machine.uid).length > 0
-
-    #   if machine.isMine() and not hasWorkspace
-    #     KD.userWorkspaces.push @getDummyWorkspace machine
-
-    #   @sortWorkspaces KD.userWorkspaces
-
-    #   KD.userWorkspaces.forEach (workspace) ->
-
-    #     unless workspace instanceof KD.remote.api.JWorkspace
-    #       workspace = KD.remote.revive workspace
-
-    #     if workspace.machineUId is machine.uid
-    #       ideRoute = "/IDE/#{machine.slug or machine.label}/#{workspace.slug}"
-    #       title    = "#{workspace.name}"
-
-    #       unless isMyMachine
-    #         if channelId = workspace.channelId
-    #         then ideRoute = "/IDE/#{channelId}"
-    #         else
-    #           return
-
-    #       if not workspace.isDefault or workspace.slug isnt 'my-workspace'
-    #         title += "<span class='ws-settings-icon'></span>"
-
-    #       treeData.push
-    #         title        : title
-    #         type         : 'workspace'
-    #         href         : ideRoute
-    #         machineLabel : machine.slug or machine.label
-    #         data         : workspace
-    #         id           : workspace._id
-    #         parentId     : machine.getId()
-
-    # for data in treeData
-
-    #   node = @machineTree.addNode data
-
-    #   @mapWorkspaceWithChannel data, node  if data.type is 'workspace'
-
-    # @emit 'MachinesListed'
-
-
-  # getDummyWorkspace: (machine) ->
-
-    # new KD.remote.api.JWorkspace
-    #   _id          : "#{machine.getId()}-my-workspace"
-    #   isDummy      : yes
-    #   isDefault    : yes
-    #   originId     : KD.whoami()._id # In case JAccount is not revived yet
-    #   slug         : 'my-workspace'
-    #   machineUId   : machine.uid
-    #   machineLabel : machine.label
-    #   name         : 'My Workspace'
-
-
-  # sortWorkspaces: (workspaces) ->
-
-    # workspaces.sort (a, b) ->
-    #   switch
-    #     when a.slug is 'my-workspace' then -1
-    #     when b.slug is 'my-workspace' then 1
-    #     when a.slug < b.slug then -1
-    #     when a.slug > b.slug then 1
-    #     else 0
-
-
-  # mapWorkspaceWithChannel: (data, node) ->
-
-    # return  unless data.data?.channelId?
-
-    # { channelId } = data.data
-
-    # @workspaceItemChannelMap[channelId] = node
-
-
   selectWorkspace: (data) ->
 
     { machine, workspace } = data

      @sharedMachinesList.updateList data.shared.concat data.collaboration


    # @machineTree.removeAllNodes()
    # @listMachines machines

    # @selectWorkspace()


  invalidateWorkspaces: (machine)->

    return  unless machine?

    for machineList in @machineLists
      machineList.selectMachineAndWorkspace machine.uid, workspace.slug


  # TODO: Rename this method to fetchEnvironment - acet!
  fetchMachines: (callback) ->

    environmentDataProvider.fetch (data) =>
      callback data


  addMachineList: ->
