{"version":3,"sources":["webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/components/conversation.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/containers/conversation_container.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/containers/conversations_list_container.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/index.js"],"names":["Conversation","_this","context","router","_this$props","props","lastStatusId","unread","markRead","history","push","onMoveUp","conversationId","onMoveDown","render","_this$props2","this","accounts","Object","jsx","status_container","id","otherAccounts","handleHotkeyMoveUp","handleHotkeyMoveDown","onClick","handleClick","ImmutablePureComponent","PropTypes","object","string","isRequired","ImmutablePropTypes","list","bool","func","connect","state","_ref","conversation","getIn","find","x","get","map","accountId","dispatch","_ref2","markConversationRead","ConversationsList","conversations","findIndex","elementIndex","getCurrentIndex","_selectChild","c","node","debounce_default","last","onLoadMore","leading","index","element","querySelector","focus","_this2","other","objectWithoutPropertiesLoose","react_default","a","createElement","scrollable_list","esm_extends","handleLoadOlder","scrollKey","ref","setRef","item","conversation_container","handleMoveUp","handleMoveDown","hasMore","isLoading","shouldUpdateScroll","maxId","expandConversations","messages","defineMessages","title","defaultMessage","DirectTimeline","injectIntl","columnId","removeColumn","addColumn","dir","moveColumn","column","scrollTop","componentDidMount","mountConversations","disconnect","connectDirectStream","componentWillUnmount","unmountConversations","_this$props3","intl","hasUnread","multiColumn","pinned","label","formatMessage","column_header","icon","active","onPin","handlePin","onMove","handleMove","handleHeaderClick","conversations_list_container","trackScroll","timelineId","handleLoadMore","emptyMessage","index_es","React","PureComponent"],"mappings":"iSAMqBA,8LAgBL,WACZ,GAAKC,EAAKC,QAAQC,OAAlB,CADkB,IAAAC,EAKyBH,EAAKI,MAAxCC,EALUF,EAKVE,aAAcC,EALJH,EAKIG,OAAQ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OJ,EAAKK,cAAczB,EAASE,QAC3DtE,OAAAC,EAAA,EAAAD,CAAC8F,EAAA,EAAD,CACEC,KAAK,WACLC,OAAQP,EACRnB,MAAOkB,EAAKK,cAAczB,EAASE,OACnC2B,MAAOnG,KAAKoG,UACZC,OAAQrG,KAAKsG,WACb7F,QAAST,KAAKuG,kBACdV,OAAQA,EACRD,YAAaA,IAGf1F,OAAAC,EAAA,EAAAD,CAACsG,EAAD,CACEC,aAAcZ,EACdnC,UAAS,mBAAqBkB,EAC9B8B,WAAW,SACX/D,WAAY3C,KAAK2G,eACjBC,aAAc1G,OAAAC,EAAA,EAAAD,CAAC2G,EAAA,EAAD,CAAkBxG,GAAG,sBAAsBoE,eAAe,gGACxEN,mBAAoBA,SA9ED2C,IAAMC","file":"features/direct_timeline.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport StatusContainer from '../../../containers/status_container';\n\nexport default class Conversation extends ImmutablePureComponent {\n\n  static contextTypes = {\n    router: PropTypes.object,\n  };\n\n  static propTypes = {\n    conversationId: PropTypes.string.isRequired,\n    accounts: ImmutablePropTypes.list.isRequired,\n    lastStatusId: PropTypes.string,\n    unread:PropTypes.bool.isRequired,\n    onMoveUp: PropTypes.func,\n    onMoveDown: PropTypes.func,\n    markRead: PropTypes.func.isRequired,\n  };\n\n  handleClick = () => {\n    if (!this.context.router) {\n      return;\n    }\n\n    const { lastStatusId, unread, markRead } = this.props;\n\n    if (unread) {\n      markRead();\n    }\n\n    this.context.router.history.push(`/statuses/${lastStatusId}`);\n  }\n\n  handleHotkeyMoveUp = () => {\n    this.props.onMoveUp(this.props.conversationId);\n  }\n\n  handleHotkeyMoveDown = () => {\n    this.props.onMoveDown(this.props.conversationId);\n  }\n\n  render () {\n    const { accounts, lastStatusId, unread } = this.props;\n\n    if (lastStatusId === null) {\n      return null;\n    }\n\n    return (\n      <StatusContainer\n        id={lastStatusId}\n        unread={unread}\n        otherAccounts={accounts}\n        onMoveUp={this.handleHotkeyMoveUp}\n        onMoveDown={this.handleHotkeyMoveDown}\n        onClick={this.handleClick}\n      />\n    );\n  }\n\n}\n","import { connect } from 'react-redux';\nimport Conversation from '../components/conversation';\nimport { markConversationRead } from '../../../actions/conversations';\n\nconst mapStateToProps = (state, { conversationId }) => {\n  const conversation = state.getIn(['conversations', 'items']).find(x => x.get('id') === conversationId);\n\n  return {\n    accounts: conversation.get('accounts').map(accountId => state.getIn(['accounts', accountId], null)),\n    unread: conversation.get('unread'),\n    lastStatusId: conversation.get('last_status', null),\n  };\n};\n\nconst mapDispatchToProps = (dispatch, { conversationId }) => ({\n  markRead: () => dispatch(markConversationRead(conversationId)),\n});\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Conversation);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport ConversationContainer from '../containers/conversation_container';\nimport ScrollableList from '../../../components/scrollable_list';\nimport { debounce } from 'lodash';\n\nexport default class ConversationsList extends ImmutablePureComponent {\n\n  static propTypes = {\n    conversations: ImmutablePropTypes.list.isRequired,\n    hasMore: PropTypes.bool,\n    isLoading: PropTypes.bool,\n    onLoadMore: PropTypes.func,\n    shouldUpdateScroll: PropTypes.func,\n  };\n\n  getCurrentIndex = id => this.props.conversations.findIndex(x => x.get('id') === id)\n\n  handleMoveUp = id => {\n    const elementIndex = this.getCurrentIndex(id) - 1;\n    this._selectChild(elementIndex);\n  }\n\n  handleMoveDown = id => {\n    const elementIndex = this.getCurrentIndex(id) + 1;\n    this._selectChild(elementIndex);\n  }\n\n  _selectChild (index) {\n    const element = this.node.node.querySelector(`article:nth-of-type(${index + 1}) .focusable`);\n\n    if (element) {\n      element.focus();\n    }\n  }\n\n  setRef = c => {\n    this.node = c;\n  }\n\n  handleLoadOlder = debounce(() => {\n    const last = this.props.conversations.last();\n\n    if (last && last.get('last_status')) {\n      this.props.onLoadMore(last.get('last_status'));\n    }\n  }, 300, { leading: true })\n\n  render () {\n    const { conversations, onLoadMore, ...other } = this.props;\n\n    return (\n      <ScrollableList {...other} onLoadMore={onLoadMore && this.handleLoadOlder} scrollKey='direct' ref={this.setRef}>\n        {conversations.map(item => (\n          <ConversationContainer\n            key={item.get('id')}\n            conversationId={item.get('id')}\n            onMoveUp={this.handleMoveUp}\n            onMoveDown={this.handleMoveDown}\n          />\n        ))}\n      </ScrollableList>\n    );\n  }\n\n}\n","import { connect } from 'react-redux';\nimport ConversationsList from '../components/conversations_list';\nimport { expandConversations } from '../../../actions/conversations';\n\nconst mapStateToProps = state => ({\n  conversations: state.getIn(['conversations', 'items']),\n  isLoading: state.getIn(['conversations', 'isLoading'], true),\n  hasMore: state.getIn(['conversations', 'hasMore'], false),\n});\n\nconst mapDispatchToProps = dispatch => ({\n  onLoadMore: maxId => dispatch(expandConversations({ maxId })),\n});\n\nexport default connect(mapStateToProps, mapDispatchToProps)(ConversationsList);\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport Column from '../../components/column';\nimport ColumnHeader from '../../components/column_header';\nimport { mountConversations, unmountConversations, expandConversations } from '../../actions/conversations';\nimport { addColumn, removeColumn, moveColumn } from '../../actions/columns';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport { connectDirectStream } from '../../actions/streaming';\nimport ConversationsListContainer from './containers/conversations_list_container';\n\nconst messages = defineMessages({\n  title: { id: 'column.direct', defaultMessage: 'Direct messages' },\n});\n\nexport default @connect()\n@injectIntl\nclass DirectTimeline extends React.PureComponent {\n\n  static propTypes = {\n    dispatch: PropTypes.func.isRequired,\n    shouldUpdateScroll: PropTypes.func,\n    columnId: PropTypes.string,\n    intl: PropTypes.object.isRequired,\n    hasUnread: PropTypes.bool,\n    multiColumn: PropTypes.bool,\n  };\n\n  handlePin = () => {\n    const { columnId, dispatch } = this.props;\n\n    if (columnId) {\n      dispatch(removeColumn(columnId));\n    } else {\n      dispatch(addColumn('DIRECT', {}));\n    }\n  }\n\n  handleMove = (dir) => {\n    const { columnId, dispatch } = this.props;\n    dispatch(moveColumn(columnId, dir));\n  }\n\n  handleHeaderClick = () => {\n    this.column.scrollTop();\n  }\n\n  componentDidMount () {\n    const { dispatch } = this.props;\n\n    dispatch(mountConversations());\n    dispatch(expandConversations());\n    this.disconnect = dispatch(connectDirectStream());\n  }\n\n  componentWillUnmount () {\n    this.props.dispatch(unmountConversations());\n\n    if (this.disconnect) {\n      this.disconnect();\n      this.disconnect = null;\n    }\n  }\n\n  setRef = c => {\n    this.column = c;\n  }\n\n  handleLoadMore = maxId => {\n    this.props.dispatch(expandConversations({ maxId }));\n  }\n\n  render () {\n    const { intl, hasUnread, columnId, multiColumn, shouldUpdateScroll } = this.props;\n    const pinned = !!columnId;\n\n    return (\n      <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>\n        <ColumnHeader\n          icon='envelope'\n          active={hasUnread}\n          title={intl.formatMessage(messages.title)}\n          onPin={this.handlePin}\n          onMove={this.handleMove}\n          onClick={this.handleHeaderClick}\n          pinned={pinned}\n          multiColumn={multiColumn}\n        />\n\n        <ConversationsListContainer\n          trackScroll={!pinned}\n          scrollKey={`direct_timeline-${columnId}`}\n          timelineId='direct'\n          onLoadMore={this.handleLoadMore}\n          emptyMessage={<FormattedMessage id='empty_column.direct' defaultMessage=\"You don't have any direct messages yet. When you send or receive one, it will show up here.\" />}\n          shouldUpdateScroll={shouldUpdateScroll}\n        />\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}