 
   newWorkspaceCreated: (workspace) ->
 
-    matches = globals.userWorkspaces.filter (w) ->
-      w.machineUId is workspace.machineUId and \
-      w.slug is workspace.slug
-
-    return  if matches.length
-
-    globals.userWorkspaces.push workspace
-    @updateMachineTree()
+    @updateMachines()
+
+
+    # matches = globals.userWorkspaces.filter (w) ->
+    #   w.machineUId is workspace.machineUId and \
+    #   w.slug is workspace.slug
+
+    # return  if matches.length
+
+    # globals.userWorkspaces.push workspace
+    # @updateMachineTree()


    @sharedMachinesList.removeWorkspaceByChannelId id

    # if @workspaceItemChannelMap[id]
    #   @fetchMachines => @fetchWorkspaces()




  # 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()
