<commit_before>@ParticipantsList = React.createClass(
  #This method is not called for the initial render.
  componentWillReceiveProps: (nextProps) ->
    current_participants = this.state.participants
    updated_participants = current_participants

    addOrUpdateParticipant =(new_participant) ->
      existing_participant_index = _.findIndex(current_participants, (current_participant) ->
          current_participant.uuid is new_participant.uuid
      )
      if existing_participant_index?
        new_name = if new_participant.name? then new_participant.name else current_participants[existing_participant_index].name 
        new_participant = {uuid: new_participant.uuid, name: new_name, status: new_participant.status }
        current_participants[existing_participant_index] = new_participant
      else
        updated_participants.push(new_participant)

    if nextProps.onlineParticipants?
        _.each(nextProps.onlineParticipants, (participant) ->
            addOrUpdateParticipant(participant)
        )
    else if nextProps.newParticipant?
      addOrUpdateParticipant(nextProps.newParticipant)

    this.setState
        participants: updated_participants
  
  getDefaultProp: ->
    participants: this.props.participants

  getInitialState: ->
    participants: ( this.props.participants || this.props.onlineParticipants )
  render: ->
      <div className="panel panel-default">
          <div className="panel-heading c-list">
                    <span className="title">Participants ({countOnlineParticipants(this.state.participants)} online)</span>
          </div>

          <ul className="list-group" id="contact-list">
            {
                this.state.participants.map( (participant)->
                    <ParticipantStatus key={participant.uuid} participant={participant} />
                )
            }
          </ul>
      </div>
    
)
<commit_msg>Update email only if not nil<commit_after>@ParticipantsList = React.createClass(
  #This method is not called for the initial render.
  componentWillReceiveProps: (nextProps) ->
    current_participants = this.state.participants
    updated_participants = current_participants

    addOrUpdateParticipant =(new_participant) ->
      existing_participant_index = _.findIndex(current_participants, (current_participant) ->
          current_participant.uuid is new_participant.uuid
      )
      if existing_participant_index?
        new_name = if new_participant.name? then new_participant.name else current_participants[existing_participant_index].name 
        new_email = if new_participant.email? then new_participant.email else current_participants[existing_participant_index].email 

        new_participant = {uuid: new_participant.uuid, name: new_name, status: new_participant.status, email: new_email  }
        current_participants[existing_participant_index] = new_participant
      else
        updated_participants.push(new_participant)

    if nextProps.onlineParticipants?
        _.each(nextProps.onlineParticipants, (participant) ->
            addOrUpdateParticipant(participant)
        )
    else if nextProps.newParticipant?
      addOrUpdateParticipant(nextProps.newParticipant)

    this.setState
        participants: updated_participants
  
  getDefaultProp: ->
    participants: this.props.participants

  getInitialState: ->
    participants: ( this.props.participants || this.props.onlineParticipants )
  render: ->
      <div className="panel panel-default">
          <div className="panel-heading c-list">
                    <span className="title">Participants ({countOnlineParticipants(this.state.participants)} online)</span>
          </div>

          <ul className="list-group" id="contact-list">
            {
                this.state.participants.map( (participant)->
                    <ParticipantStatus key={participant.uuid} participant={participant} />
                )
            }
          </ul>
      </div>
    
)

{'fraction_non_alphanumeric': 0.08742756361803981, 'fraction_numerical': 0.0, 'mean_word_length': 3.075975359342916, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6079869', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1041, 'n_words': 186}