<commit_before>kd                           = require 'kd'
React                        = require 'kd-react'
KDReactorMixin               = require 'app/flux/base/reactormixin'
ActivityFlux                 = require 'activity/flux'
immutable                    = require 'immutable'
classnames                   = require 'classnames'
PrivateChatPane              = require 'activity/components/privatechatpane'
ThreadSidebarContentBox      = require 'activity/components/threadsidebarcontentbox'
ChannelParticipantAvatars    = require 'activity/components/channelparticipantavatars'
ThreadSidebar                = require 'activity/components/threadsidebar'
prepareThreadTitle           = require 'activity/util/prepareThreadTitle'
ImmutableRenderMixin         = require 'react-immutable-render-mixin'
StartVideoCallLink           = require 'activity/components/common/startvideocalllink'
CollaborationComingSoonModal = require 'activity/components/collaborationcomingsoonmodal'
showNotification             = require 'app/util/showNotification'
ChannelDropContainer         = require 'activity/components/channeldropcontainer'


module.exports = class PrivateMessageThreadPane extends React.Component

  @include [ImmutableRenderMixin]

  { getters } = ActivityFlux

  getDataBindings: ->

    return {
      channelThread         : getters.selectedChannelThread
      channelParticipants   : getters.selectedChannelParticipants
      followedChannels      : getters.followedPrivateChannelThreads
    }


  constructor: (props) ->

    super props

    @state =
      showDropTarget        : no
      channelThread         : immutable.Map()
      channelParticipants   : immutable.List()
      isComingSoonModalOpen : no


  componentDidMount: ->

    reset @props, @state, =>
      scrollTop          = @state.channelThread.getIn [ 'flags', 'scrollPosition' ]
      scroller           = React.findDOMNode @refs.pane.refs.chatPane.refs.scrollContainer
      scroller.scrollTop = scrollTop  if scrollTop


  componentWillReceiveProps: (nextProps) -> reset nextProps, @state


  componentWillUnmount: ->

    # terrifying drill - SY
    { scrollTop }       = React.findDOMNode @refs.pane.refs.chatPane.refs.scrollContainer
    { channel, thread } = ActivityFlux.actions

    channel.setScrollPosition (@state.channelThread.getIn [ 'channel', 'id' ]), scrollTop
    thread.changeSelectedThread null


  onStart: ->

    @setState isComingSoonModalOpen: yes


  onClose: ->

    @setState isComingSoonModalOpen: no


  renderHeader: ->

    return  unless @state.channelThread

    prepareThreadTitle @state.channelThread


  onDragEnter: (event) ->

    kd.utils.stopDOMEvent event
    @setState showDropTarget: yes


  onDragOver: (event) -> kd.utils.stopDOMEvent event<commit_msg>activity: privatethreadpane mount mixin applied<commit_after>kd                           = require 'kd'
React                        = require 'kd-react'
KDReactorMixin               = require 'app/flux/base/reactormixin'
ActivityFlux                 = require 'activity/flux'
immutable                    = require 'immutable'
classnames                   = require 'classnames'
PrivateChatPane              = require 'activity/components/privatechatpane'
ThreadSidebarContentBox      = require 'activity/components/threadsidebarcontentbox'
ChannelParticipantAvatars    = require 'activity/components/channelparticipantavatars'
ThreadSidebar                = require 'activity/components/threadsidebar'
prepareThreadTitle           = require 'activity/util/prepareThreadTitle'
ImmutableRenderMixin         = require 'react-immutable-render-mixin'
StartVideoCallLink           = require 'activity/components/common/startvideocalllink'
CollaborationComingSoonModal = require 'activity/components/collaborationcomingsoonmodal'
showNotification             = require 'app/util/showNotification'
ChannelDropContainer         = require 'activity/components/channeldropcontainer'
threadPaneMount              = require 'activity/mixins/threadpanemount'


module.exports = class PrivateMessageThreadPane extends React.Component

  @include [ImmutableRenderMixin]

  { getters } = ActivityFlux

  getDataBindings: ->

    return {
      channelThread         : getters.selectedChannelThread
      channelParticipants   : getters.selectedChannelParticipants
      followedChannels      : getters.followedPrivateChannelThreads
    }


  constructor: (props) ->

    super props

    @state =
      showDropTarget        : no
      channelThread         : immutable.Map()
      channelParticipants   : immutable.List()
      isComingSoonModalOpen : no


  componentDidMount: -> threadPaneMount.componentDidMount.call this, reset

  componentWillReceiveProps: (nextProps) -> threadPaneMount.componentWillReceiveProps.call this, reset, nextProps

  componentWillUnmount: -> threadPaneMount.componentWillUnmount.call this


  onStart: ->

    @setState isComingSoonModalOpen: yes


  onClose: ->

    @setState isComingSoonModalOpen: no


  renderHeader: ->

    return  unless @state.channelThread

    prepareThreadTitle @state.channelThread


  onDragEnter: (event) ->

    kd.utils.stopDOMEvent event
    @setState showDropTarget: yes


  onDragOver: (event) -> kd.utils.stopDOMEvent event
{'fraction_non_alphanumeric': 0.07489070518912755, 'fraction_numerical': 0.0, 'mean_word_length': 3.016793893129771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '3956981', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1336, 'n_words': 262}