 
   onRealtimeParticipantJoined: (data) ->
 
+    return  unless @stateMachine.state is 'Active'
+
     {sessionId} = data.collaborator
 
     {targetUser} =


  cleanupCollaboration: (options = {}) ->

    return  unless @stateMachine.state is 'Ending'

    @rtm.once 'RealtimeManagerWillDispose', =>
      kd.utils.killRepeat @pingInterval


    title = @getRealtimeFileName()
    realtimeHelpers.fetchCollaborationFile @rtm, title, (err, file) =>
      return callbacks.error err  if err
      realtimeHelpers.loadCollaborationFile @rtm, file.id, (err, doc) =>
        return callbacks.error err  if err
        @rtmFileId = file.id
        callbacks.success @socialChannel, doc

