<commit_before>kd              = require 'kd'
React           = require 'kd-react'
immutable       = require 'immutable'
ActivityFlux    = require 'activity/flux'
ChatPane        = require 'activity/components/chatpane'


module.exports = class PublicChatPane extends React.Component

  @defaultProps =
    thread   : immutable.Map()
    messages : immutable.List()
    padded   : no


  channel: (key) -> @props.thread?.getIn ['channel', key]


  onSubmit: ({ value }) ->

    return  unless body = value
    name = @channel 'name'

    unless body.match ///\##{name}///
      body += " ##{name} "

    ActivityFlux.actions.message.createMessage @channel('id'), body

    @moveScrollToBottom()


  moveScrollToBottom: ->

    ChatPaneWrapper = @refs.ChatPaneWrapper.getDOMNode()
    InfiniteScroll = ChatPaneWrapper.querySelector '.InfiniteScroll'
    InfiniteScroll.scrollTop = InfiniteScroll.scrollHeight


  onLoadMore: ->

    return  unless @props.messages.size
    return  if @props.thread.getIn ['flags', 'isMessagesLoading']

    from = @props.messages.first().get('createdAt')
    kd.utils.defer => ActivityFlux.actions.message.loadMessages @channel('id'), { from }


  render: ->
    <ChatPane
      thread={@props.thread}
      className="PublicChatPane"
      messages={@props.messages}
      onSubmit={@bound 'onSubmit'}
      onLoadMore={@bound 'onLoadMore'}
      isParticipant={@channel 'isParticipant'}
    />

<commit_msg>activity: remove unused function and its call<commit_after>kd              = require 'kd'
React           = require 'kd-react'
immutable       = require 'immutable'
ActivityFlux    = require 'activity/flux'
ChatPane        = require 'activity/components/chatpane'


module.exports = class PublicChatPane extends React.Component

  @defaultProps =
    thread   : immutable.Map()
    messages : immutable.List()
    padded   : no


  channel: (key) -> @props.thread?.getIn ['channel', key]


  onSubmit: ({ value }) ->

    return  unless body = value
    name = @channel 'name'

    unless body.match ///\##{name}///
      body += " ##{name} "

    ActivityFlux.actions.message.createMessage @channel('id'), body


  onLoadMore: ->

    return  unless @props.messages.size
    return  if @props.thread.getIn ['flags', 'isMessagesLoading']

    from = @props.messages.first().get('createdAt')
    kd.utils.defer => ActivityFlux.actions.message.loadMessages @channel('id'), { from }


  render: ->
    <ChatPane
      thread={@props.thread}
      className="PublicChatPane"
      messages={@props.messages}
      onSubmit={@bound 'onSubmit'}
      onLoadMore={@bound 'onLoadMore'}
      isParticipant={@channel 'isParticipant'}
    />


{'fraction_non_alphanumeric': 0.1350037397157816, 'fraction_numerical': 0.0, 'mean_word_length': 3.0225563909774436, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '5393349', 'n_tokens_mistral': 827, 'n_tokens_neox': 791, 'n_words': 165}