           @statusBar.emit 'CollaborationEnded'
           sharedSuccessFn()
           @cleanupCollaboration()
+
+    else
+      @endCollaborationForParticipant
+        success: =>
+          # TODO: move this into its own method.
+          @removeParticipant nick()
+          @removeMachineNode()
+          sharedSuccessFn()
+          kd.utils.defer @bound 'quit'
 
 
   endCollaborationForHost: (callbacks) ->

      title   : 'Are you sure?'
      content : "If you leave this session you won't be able to return back."

    @showModal options, =>
      @stopChatSession()
      @modal.destroy()

      options = channelId: @socialChannel.getId()
      kd.singletons.socialapi.channel.leave options, (err) =>
        return showError err  if err
        @setMachineUser [nick()], no, =>
          # remove the leaving participant's info from the collaborative doc
          @whenRealtimeReady =>
            @broadcastMessage { type: 'ParticipantWantsToLeave' }
            @removeParticipant nick()


  throwError: throwError = (err, args...) ->


    if origin is nick()
      switch type
        when 'ParticipantKicked'
          return @handleParticipantKicked data.target
        else return
