mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 06:58:58 +00:00
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","onClick","role","size","timestamp","ref","setNamesRef","id","defaultMessage","values","status","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":"kbAgBA,IAAMA,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,sOAgDU,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,qDA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,GACP,EAAKgJ,OAAShJ,K,6CAGC,SAAAwI,GACf,EAAKpJ,MAAMuG,SAAS8C,YAAoB,CAAED,c,6BAtB5CvH,kBAAA,WAAsB,IACZ0E,EAAavF,KAAKhB,MAAlBuG,SAERA,EAASsD,eACTtD,EAAS8C,eACTrI,KAAK8I,WAAavD,EAASwD,gB,EAG7BC,qBAAA,WACEhJ,KAAKhB,MAAMuG,SAAS0D,eAEhBjJ,KAAK8I,aACP9I,KAAK8I,aACL9I,KAAK8I,WAAa,O,EAYtB/H,OAAA,WAAW,IAAD,EAC+Df,KAAKhB,MAApEiC,EADA,EACAA,KAAMiI,EADN,EACMA,UAAWX,EADjB,EACiBA,SAAUY,EAD3B,EAC2BA,YAAahB,EADxC,EACwCA,mBAC1CiB,IAAWb,EAEjB,OACE,kBAAC,IAAD,CAAQc,gBAAiBF,EAAa/F,IAAKpD,KAAK6H,OAAQyB,MAAOrI,EAAKG,cAAcpD,EAAS+D,QACzF,YAAC,IAAD,CACEgC,KAAK,WACLwF,OAAQL,EACRnH,MAAOd,EAAKG,cAAcpD,EAAS+D,OACnCyH,MAAOxJ,KAAKyJ,UACZC,OAAQ1J,KAAK2J,WACb3G,QAAShD,KAAK4J,kBACdR,OAAQA,EACRD,YAAaA,IAGf,YAAC,EAAD,CACEU,aAAcT,EACdxB,UAAS,mBAAqBW,EAC9BuB,WAAW,SACXjD,WAAY7G,KAAK+J,eACjBC,aAAc,YAAC,IAAD,CAAkB1G,GAAG,sBAAsBC,eAAe,gGACxE4E,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' onClick={this.handleClick} role='presentation'>\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":""} |