 
     if origin is nick()
       switch type
-        when 'ParticipantWantsToLeave'
-          @removeMachineNode()
-          return kd.utils.defer @bound 'quit'
         when 'ParticipantKicked'
           return @handleParticipantKicked data.target
         else return

      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...) ->

          @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) ->
