1 line
25 KiB
Plaintext
1 line
25 KiB
Plaintext
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/components/conversation.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/containers/conversation_container.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/containers/conversations_list_container.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/direct_timeline/index.js"],"names":["messages","defineMessages","more","open","reply","markAsRead","delete","muteConversation","unmuteConversation","Conversation","injectIntl","target","src","getAttribute","context","router","props","lastStatus","unread","markRead","history","push","get","onMoveUp","conversationId","onMoveDown","onMute","onToggleHidden","c","namesNode","_updateEmojis","node","this","autoPlayGif","emojis","querySelectorAll","i","length","emoji","classList","contains","add","addEventListener","handleEmojiMouseEnter","handleEmojiMouseLeave","componentDidMount","componentDidUpdate","render","accounts","intl","menu","text","formatMessage","action","handleClick","handleConversationMute","handleMarkAsRead","handleDelete","names","map","a","to","href","title","className","dangerouslySetInnerHTML","__html","reduce","prev","cur","handlers","handleReply","moveUp","handleHotkeyMoveUp","moveDown","handleHotkeyMoveDown","toggleHidden","handleShowMore","classNames","tabIndex","size","timestamp","ref","setNamesRef","id","defaultMessage","values","status","onClick","expanded","onExpandedToggle","collapsable","compact","media","icon","items","direction","ImmutablePureComponent","PropTypes","object","string","isRequired","ImmutablePropTypes","list","bool","func","replyConfirm","replyMessage","connect","getStatus","makeGetStatus","state","conversation","getIn","find","x","lastStatusId","accountId","dispatch","markConversationRead","_","getState","trim","openModal","message","confirm","onConfirm","replyCompose","deleteConversation","unmuteStatus","muteStatus","revealStatus","hideStatus","ConversationsList","conversations","findIndex","elementIndex","getCurrentIndex","_selectChild","last","onLoadMore","leading","index","align_top","container","element","querySelector","scrollTop","offsetTop","scrollIntoView","clientHeight","offsetHeight","focus","other","handleLoadOlder","scrollKey","setRef","item","handleMoveUp","handleMoveDown","hasMore","isLoading","shouldUpdateScroll","maxId","expandConversations","DirectTimeline","columnId","removeColumn","addColumn","dir","moveColumn","column","mountConversations","disconnect","connectDirectStream","componentWillUnmount","unmountConversations","hasUnread","multiColumn","pinned","bindToDocument","label","active","onPin","handlePin","onMove","handleMove","handleHeaderClick","trackScroll","timelineId","handleLoadMore","emptyMessage","React","PureComponent"],"mappings":"6XAgBMA,EAAWC,YAAe,CAC9BC,KAAK,CAAD,wCACJC,KAAK,CAAD,2DACJC,MAAM,CAAD,0CACLC,WAAW,CAAD,8DACVC,OAAO,CAAD,+DACNC,iBAAiB,CAAD,kEAChBC,mBAAmB,CAAD,wEAIdC,EADUC,a,2MAgDU,YAAiB,IAAdC,EAAa,EAAbA,OACzBA,EAAOC,IAAMD,EAAOE,aAAa,oB,oDAGX,YAAiB,IAAdF,EAAa,EAAbA,OACzBA,EAAOC,IAAMD,EAAOE,aAAa,kB,0CAGrB,WACZ,GAAK,EAAKC,QAAQC,OAAlB,CADkB,MAKuB,EAAKC,MAAtCC,EALU,EAKVA,WAAYC,EALF,EAKEA,OAAQC,EALV,EAKUA,SAExBD,GACFC,IAGF,EAAKL,QAAQC,OAAOK,QAAQC,KAA5B,aAA8CJ,EAAWK,IAAI,W,+CAG5C,WACjB,EAAKN,MAAMG,c,0CAGC,WACZ,EAAKH,MAAMZ,MAAM,EAAKY,MAAMC,WAAY,EAAKH,QAAQC,OAAOK,Y,2CAG/C,WACb,EAAKJ,MAAMV,Y,iDAGQ,WACnB,EAAKU,MAAMO,SAAS,EAAKP,MAAMQ,mB,mDAGV,WACrB,EAAKR,MAAMS,WAAW,EAAKT,MAAMQ,mB,qDAGV,WACvB,EAAKR,MAAMU,OAAO,EAAKV,MAAMC,e,6CAGd,WACf,EAAKD,MAA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WAAsB,IACZyE,EAAatF,KAAKhB,MAAlBsG,SAERA,EAASsD,eACTtD,EAAS8C,eACTpI,KAAK6I,WAAavD,EAASwD,gB,EAG7BC,qBAAA,WACE/I,KAAKhB,MAAMsG,SAAS0D,eAEhBhJ,KAAK6I,aACP7I,KAAK6I,aACL7I,KAAK6I,WAAa,O,EAYtB9H,OAAA,WAAW,IAAD,EAC+Df,KAAKhB,MAApEiC,EADA,EACAA,KAAMgI,EADN,EACMA,UAAWX,EADjB,EACiBA,SAAUY,EAD3B,EAC2BA,YAAahB,EADxC,EACwCA,mBAC1CiB,IAAWb,EAEjB,OACE,kBAAC,IAAD,CAAQc,gBAAiBF,EAAahG,IAAKlD,KAAK4H,OAAQyB,MAAOpI,EAAKG,cAAcpD,EAAS+D,QACzF,YAAC,IAAD,CACE+B,KAAK,WACLwF,OAAQL,EACRlH,MAAOd,EAAKG,cAAcpD,EAAS+D,OACnCwH,MAAOvJ,KAAKwJ,UACZC,OAAQzJ,KAAK0J,WACblG,QAASxD,KAAK2J,kBACdR,OAAQA,EACRD,YAAaA,IAGf,YAAC,EAAD,CACEU,aAAcT,EACdxB,UAAS,mBAAqBW,EAC9BuB,WAAW,SACXjD,WAAY5G,KAAK8J,eACjBC,aAAc,YAAC,IAAD,CAAkB3G,GAAG,sBAAsBC,eAAe,gGACxE6E,mBAAoBA,M,GA9ED8B,IAAMC,iB","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 StatusContent from 'mastodon/components/status_content';\nimport AttachmentList from 'mastodon/components/attachment_list';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container';\nimport AvatarComposite from 'mastodon/components/avatar_composite';\nimport Permalink from 'mastodon/components/permalink';\nimport IconButton from 'mastodon/components/icon_button';\nimport RelativeTimestamp from 'mastodon/components/relative_timestamp';\nimport { HotKeys } from 'react-hotkeys';\nimport { autoPlayGif } from 'mastodon/initial_state';\nimport classNames from 'classnames';\n\nconst messages = defineMessages({\n more: { id: 'status.more', defaultMessage: 'More' },\n open: { id: 'conversation.open', defaultMessage: 'View conversation' },\n reply: { id: 'status.reply', defaultMessage: 'Reply' },\n markAsRead: { id: 'conversation.mark_as_read', defaultMessage: 'Mark as read' },\n delete: { id: 'conversation.delete', defaultMessage: 'Delete conversation' },\n muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },\n unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' },\n});\n\nexport default @injectIntl\nclass 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 lastStatus: ImmutablePropTypes.map,\n unread:PropTypes.bool.isRequired,\n onMoveUp: PropTypes.func,\n onMoveDown: PropTypes.func,\n markRead: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n intl: PropTypes.object.isRequired,\n };\n\n _updateEmojis () {\n const node = this.namesNode;\n\n if (!node || autoPlayGif) {\n return;\n }\n\n const emojis = node.querySelectorAll('.custom-emoji');\n\n for (var i = 0; i < emojis.length; i++) {\n let emoji = emojis[i];\n if (emoji.classList.contains('status-emoji')) {\n continue;\n }\n emoji.classList.add('status-emoji');\n\n emoji.addEventListener('mouseenter', this.handleEmojiMouseEnter, false);\n emoji.addEventListener('mouseleave', this.handleEmojiMouseLeave, false);\n }\n }\n\n componentDidMount () {\n this._updateEmojis();\n }\n\n componentDidUpdate () {\n this._updateEmojis();\n }\n\n handleEmojiMouseEnter = ({ target }) => {\n target.src = target.getAttribute('data-original');\n }\n\n handleEmojiMouseLeave = ({ target }) => {\n target.src = target.getAttribute('data-static');\n }\n\n handleClick = () => {\n if (!this.context.router) {\n return;\n }\n\n const { lastStatus, unread, markRead } = this.props;\n\n if (unread) {\n markRead();\n }\n\n this.context.router.history.push(`/statuses/${lastStatus.get('id')}`);\n }\n\n handleMarkAsRead = () => {\n this.props.markRead();\n }\n\n handleReply = () => {\n this.props.reply(this.props.lastStatus, this.context.router.history);\n }\n\n handleDelete = () => {\n this.props.delete();\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 handleConversationMute = () => {\n this.props.onMute(this.props.lastStatus);\n }\n\n handleShowMore = () => {\n this.props.onToggleHidden(this.props.lastStatus);\n }\n\n setNamesRef = (c) => {\n this.namesNode = c;\n }\n\n render () {\n const { accounts, lastStatus, unread, intl } = this.props;\n\n if (lastStatus === null) {\n return null;\n }\n\n const menu = [\n { text: intl.formatMessage(messages.open), action: this.handleClick },\n null,\n ];\n\n menu.push({ text: intl.formatMessage(lastStatus.get('muted') ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMute });\n\n if (unread) {\n menu.push({ text: intl.formatMessage(messages.markAsRead), action: this.handleMarkAsRead });\n menu.push(null);\n }\n\n menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDelete });\n\n const names = accounts.map(a => <Permalink to={`/accounts/${a.get('id')}`} href={a.get('url')} key={a.get('id')} title={a.get('acct')}><bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} /></bdi></Permalink>).reduce((prev, cur) => [prev, ', ', cur]);\n\n const handlers = {\n reply: this.handleReply,\n open: this.handleClick,\n moveUp: this.handleHotkeyMoveUp,\n moveDown: this.handleHotkeyMoveDown,\n toggleHidden: this.handleShowMore,\n };\n\n return (\n <HotKeys handlers={handlers}>\n <div className={classNames('conversation focusable muted', { 'conversation--unread': unread })} tabIndex='0'>\n <div className='conversation__avatar'>\n <AvatarComposite accounts={accounts} size={48} />\n </div>\n\n <div className='conversation__content'>\n <div className='conversation__content__info'>\n <div className='conversation__content__relative-time'>\n {unread && <span className='conversation__unread' />} <RelativeTimestamp timestamp={lastStatus.get('created_at')} />\n </div>\n\n <div className='conversation__content__names' ref={this.setNamesRef}>\n <FormattedMessage id='conversation.with' defaultMessage='With {names}' values={{ names: <span>{names}</span> }} />\n </div>\n </div>\n\n <StatusContent\n status={lastStatus}\n onClick={this.handleClick}\n expanded={!lastStatus.get('hidden')}\n onExpandedToggle={this.handleShowMore}\n collapsable\n />\n\n {lastStatus.get('media_attachments').size > 0 && (\n <AttachmentList\n compact\n media={lastStatus.get('media_attachments')}\n />\n )}\n\n <div className='status__action-bar'>\n <IconButton className='status__action-bar-button' title={intl.formatMessage(messages.reply)} icon='reply' onClick={this.handleReply} />\n\n <div className='status__action-bar-dropdown'>\n <DropdownMenuContainer status={lastStatus} items={menu} icon='ellipsis-h' size={18} direction='right' title={intl.formatMessage(messages.more)} />\n </div>\n </div>\n </div>\n </div>\n </HotKeys>\n );\n }\n\n}\n","import { connect } from 'react-redux';\nimport Conversation from '../components/conversation';\nimport { markConversationRead, deleteConversation } from 'mastodon/actions/conversations';\nimport { makeGetStatus } from 'mastodon/selectors';\nimport { replyCompose } from 'mastodon/actions/compose';\nimport { openModal } from 'mastodon/actions/modal';\nimport { muteStatus, unmuteStatus, hideStatus, revealStatus } from 'mastodon/actions/statuses';\nimport { defineMessages, injectIntl } from 'react-intl';\n\nconst messages = defineMessages({\n replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' },\n replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' },\n});\n\nconst mapStateToProps = () => {\n const getStatus = makeGetStatus();\n\n return (state, { conversationId }) => {\n const conversation = state.getIn(['conversations', 'items']).find(x => x.get('id') === conversationId);\n const lastStatusId = conversation.get('last_status', null);\n\n return {\n accounts: conversation.get('accounts').map(accountId => state.getIn(['accounts', accountId], null)),\n unread: conversation.get('unread'),\n lastStatus: lastStatusId && getStatus(state, { id: lastStatusId }),\n };\n };\n};\n\nconst mapDispatchToProps = (dispatch, { intl, conversationId }) => ({\n\n markRead () {\n dispatch(markConversationRead(conversationId));\n },\n\n reply (status, router) {\n dispatch((_, getState) => {\n let state = getState();\n\n if (state.getIn(['compose', 'text']).trim().length !== 0) {\n dispatch(openModal('CONFIRM', {\n message: intl.formatMessage(messages.replyMessage),\n confirm: intl.formatMessage(messages.replyConfirm),\n onConfirm: () => dispatch(replyCompose(status, router)),\n }));\n } else {\n dispatch(replyCompose(status, router));\n }\n });\n },\n\n delete () {\n dispatch(deleteConversation(conversationId));\n },\n\n onMute (status) {\n if (status.get('muted')) {\n dispatch(unmuteStatus(status.get('id')));\n } else {\n dispatch(muteStatus(status.get('id')));\n }\n },\n\n onToggleHidden (status) {\n if (status.get('hidden')) {\n dispatch(revealStatus(status.get('id')));\n } else {\n dispatch(hideStatus(status.get('id')));\n }\n },\n\n});\n\nexport default injectIntl(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, true);\n }\n\n handleMoveDown = id => {\n const elementIndex = this.getCurrentIndex(id) + 1;\n this._selectChild(elementIndex, false);\n }\n\n _selectChild (index, align_top) {\n const container = this.node.node;\n const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);\n\n if (element) {\n if (align_top && container.scrollTop > element.offsetTop) {\n element.scrollIntoView(true);\n } else if (!align_top && container.scrollTop + container.clientHeight < element.offsetTop + element.offsetHeight) {\n element.scrollIntoView(false);\n }\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 bindToDocument={!multiColumn} 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":""} |