pleroma/priv/static/packs/flavours/glitch/async/direct_timeline.js

2 lines
12 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[55],{740:function(e,t,n){"use strict";n.r(t);var a,o,s,i,c=n(0),r=n(2),d=n(7),l=n(1),u=n(3),p=n.n(u),b=n(12),h=n(973),v=n(667),f=n(664),m=n(33),j=n(110),O=n(243),g=n(6),M=n(1014),y=Object(g.f)({filter_regex:{id:"home.column_settings.filter_regex",defaultMessage:"Filter out by regular expressions"},settings:{id:"home.settings",defaultMessage:"Column settings"}}),_=Object(g.g)(a=function(e){function t(){return e.apply(this,arguments)||this}return Object(d.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.settings,n=e.onChange,a=e.intl;return Object(c.a)("div",{},void 0,Object(c.a)("span",{className:"column-settings__section"},void 0,Object(c.a)(g.b,{id:"home.column_settings.advanced",defaultMessage:"Advanced"})),Object(c.a)("div",{className:"column-settings__row"},void 0,Object(c.a)(M.a,{settings:t,settingPath:["regex","body"],onChange:n,label:a.formatMessage(y.filter_regex)})))},t}(p.a.PureComponent))||a,C=n(71),k=Object(b.connect)(function(e){return{settings:e.getIn(["settings","direct"])}},function(e){return{onChange:function(t,n){e(Object(C.c)(["direct"].concat(t),n))}}})(_),w=n(671),I=n(22),x=n(31),R=n(63),S=n.n(R),L=n(5),T=n.n(L),D=n(18),N=n.n(D),U=n(19),H=n(13),E=n(150),A=n(256),q=n(673),K=n(681),P=n(218),W=n(40),z=n(97),V=n(287),B=Object(g.f)({more:{id:"status.more",defaultMessage:"More"},open:{id:"conversation.open",defaultMessage:"View conversation"},reply:{id:"status.reply",defaultMessage:"Reply"},markAsRead:{id:"conversation.mark_as_read",defaultMessage:"Mark as read"},delete:{id:"conversation.delete",defaultMessage:"Delete conversation"},muteConversation:{id:"status.mute_conversation",defaultMessage:"Mute conversation"},unmuteConversation:{id:"status.unmute_conversation",defaultMessage:"Unmute conversation"}}),F=Object(g.g)((i=s=function(e){function t(){for(var t,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a))||this,Object(l.a)(Object(r.a)(t),"state",{isExpanded:void 0}),Object(l.a)(Object(r.a)(t),"parseClick",function(e,n){var a=t.context.router,o=t.props,s=o.lastStatus,i=o.unread,c=o.markRead;if(a&&0===e.button&&!(e.ctrlKey||e.altKey||e.metaKey)){void 0===n&&(i&&c(),n="/statuses/"+s.get("id"));var r=Object(H.default)({},a.history.location.state);r.mastodonBackSteps=(r.mastodonBackSteps||0)+1,a.history.push(n,r),e.preventDefault()}}),Object(l.a)(Object(r.a)(t),"handleClick",function(){if(t.context.router){var e=t.props,n=e.lastStatus,a=e.unread,o=e.markRead;a&&o(),t.context.router.history.push("/statuses/"+n.get("id"))}}),Object(l.a)(Object(r.a)(t),"handleMarkAsRead",function(){t.props.markRead()}),Object(l.a)(Object(r.a)(t),"handleReply",function(){t.props.reply(t.props.lastStatus,t.context.router.history)}),Object(l.a)(Object(r.a)(t),"handleDelete",function(){t.props.delete()}),Object(l.a)(Object(r.a)(t),"handleHotkeyMoveUp",function(){t.props.onMoveUp(t.props.conversationId)}),Object(l.a)(Object(r.a)(t),"handleHotkeyMoveDown",function(){t.props.onMoveDown(t.props.conversationId)}),Object(l.a)(Object(r.a)(t),"handleConversationMute",function(){t.props.onMute(t.props.lastStatus)}),Object(l.a)(Object(r.a)(t),"handleShowMore",function(){t.props.lastStatus.get("spoiler_text")&&t.setExpansion(!t.state.isExpanded)}),Object(l.a)(Object(r.a)(t),"setExpansion",function(e){t.setState({isExpanded:e})}),t}return Object(d.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.accounts,n=e.lastStatus,a=e.unread,o=e.intl,s=this.state.isExpanded;if(null===n)return null;var i=[{text:o.formatMessage(B.open),action:this.handleClick},null];i.push({text:o.formatMessage(n.get("muted")?B.unmuteConversation:B.muteConversation),action:this.handleConversationMute}),a&&(i.push({text:o.formatMessage(B.markAsRead),action:this.handleMarkAsRead}),i.push(null)),i.push({text:o.formatMessage(B.delete),action:this.handleDelete});var r=t.map(function(e){return Object(c.a)(P.a,{to:"/accounts/"+e.get("id"),href:e.get("url"),title:e.get("acct")},e.get("id"),Object(c.a)("bdi",{},void 0,Object(c.a)("strong",{className:"display-name__html",dangerouslySetInnerHTML:{__html:e.get("display_name_html")}})))}).reduce(function(e,t){return[e,", ",t]}),d={reply:this.handleReply,open:this.handleClick,moveUp:this.handleHotkeyMoveUp,moveDown:this.handleHotkeyMoveDown,toggleHidden:this.handleShowMore},l=null;return n.get("media_attachments").size>0&&(l=Object(c.a)(A.a,{compact:!0,media:n.get("media_attachments")})),Object(c.a)(V.HotKeys,{handlers:d},void 0,Object(c.a)("div",{className:"conversation focusable muted",tabIndex:"0"},void 0,Object(c.a)("div",{className:"conversation__avatar"},void 0,Object(c.a)(K.a,{accounts:t,size:48})),Object(c.a)("div",{className:"conversation__content"},void 0,Object(c.a)("div",{className:"conversation__content__info"},void 0,Object(c.a)("div",{className:"conversation__content__relative-time"},void 0,Object(c.a)(z.default,{timestamp:n.get("created_at")})),Object(c.a)("div",{className:"conversation__content__names"},void 0,Object(c.a)(g.b,{id:"conversation.with",defaultMessage:"With {names}",values:{names:Object(c.a)("span",{},void 0,r)}}))),Object(c.a)(E.a,{status:n,parseClick:this.parseClick,expanded:s,onExpandedToggle:this.handleShowMore,collapsable:!0,media:l}),Object(c.a)("div",{className:"status__action-bar"},void 0,Object(c.a)(W.a,{className:"status__action-bar-button",title:o.formatMessage(B.reply),icon:"reply",onClick:this.handleReply}),Object(c.a)("div",{className:"status__action-bar-dropdown"},void 0,Object(c.a)(q.a,{status:n,items:i,icon:"ellipsis-h",size:18,direction:"right",title:o.formatMessage(B.more)}))))))},t}(U.a),Object(l.a)(s,"contextTypes",{router:T.a.object}),Object(l.a)(s,"propTypes",{conversationId:T.a.string.isRequired,accounts:N.a.list.isRequired,lastStatus:N.a.map,unread:T.a.bool.isRequired,onMoveUp:T.a.func,onMoveDown:T.a.func,markRead:T.a.func.isRequired,intl:T.a.object.isRequired}),o=i))||o,J=n(148),Y=n(16),G=n(42),Q=n(109),X=Object(g.f)({replyConfirm:{id:"confirmations.reply.confirm",defaultMessage:"Reply"},replyMessage:{id:"confirmations.reply.message",defaultMessage:"Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?"}}),Z=Object(g.g)(Object(b.connect)(function(){var e=Object(J.f)();return function(t,n){var a=n.conversationId,o=t.getIn(["conversations","items"]).find(function(e){return e.get("id")===a}),s=o.get("last_status",null);return{accounts:o.get("accounts").map(function(e){return t.getIn(["accounts",e],null)}),unread:o.get("unread"),lastStatus:s&&e(t,{id:s})}}},function(e,t){var n=t.intl,a=t.conversationId;return{markRead:function(){e(Object(j.j)(a))},reply:function(t,a){e(function(o,s){0!==s().getIn(["compose","text"]).trim().length?e(Object(G.d)("CONFIRM",{message:n.formatMessage(X.replyMessage),confirm:n.formatMessage(X.replyConfirm),onConfirm:function(){return e(Object(Y.lb)(t,a))}})):e(Object(Y.lb)(t,a))})},delete:function(){e(Object(j.h)(a))},onMute:function(t){t.get("muted")?e(Object(Q.j)(t.get("id"))):e(Object(Q.h)(t.get("id")))},onToggleHidden:function(t){t.get("hidden")?e(Object(Q.revealStatus)(t.get("id"))):e(Object(Q.hideStatus)(t.get("id")))}}})(F)),$=n(963),ee=function(e){function t(){for(var t,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a))||this,Object(l.a)(Object(r.a)(t),"getCurrentIndex",function(e){return t.props.conversations.findIndex(function(t){return t.get("id")===e})}),Object(l.a)(Object(r.a)(t),"handleMoveUp",function(e){var n=t.getCurrentIndex(e)-1;t._selectChild(n,!0)}),Object(l.a)(Object(r.a)(t),"handleMoveDown",function(e){var n=t.getCurrentIndex(e)+1;t._selectChild(n,!1)}),Object(l.a)(Object(r.a)(t),"setRef",function(e){t.node=e}),Object(l.a)(Object(r.a)(t),"handleLoadOlder",S()(function(){var e=t.props.conversations.last();e&&e.get("last_status")&&t.props.onLoadMore(e.get("last_status"))},300,{leading:!0})),t}Object(d.a)(t,e);var n=t.prototype;return n._selectChild=function(e,t){var n=this.node.node,a=n.querySelector("article:nth-of-type("+(e+1)+") .focusable");a&&(t&&n.scrollTop>a.offsetTop?a.scrollIntoView(!0):!t&&n.scrollTop+n.clientHeight<a.offsetTop+a.offsetHeight&&a.scrollIntoView(!1),a.focus())},n.render=function(){var e=this,t=this.props,n=t.conversations,a=t.onLoadMore,o=Object(x.default)(t,["conversations","onLoadMore"]);return p.a.createElement($.a,Object(I.a)({},o,{onLoadMore:a&&this.handleLoadOlder,scrollKey:"direct",ref:this.setRef}),n.map(function(t){return Object(c.a)(Z,{conversationId:t.get("id"),onMoveUp:e.handleMoveUp,onMoveDown:e.handleMoveDown},t.get("id"))}))},t}(U.a);Object(l.a)(ee,"propTypes",{conversations:N.a.list.isRequired,hasMore:T.a.bool,isLoading:T.a.bool,onLoadMore:T.a.func});var te,ne=Object(b.connect)(function(e){return{conversations:e.getIn(["conversations","items"]),isLoading:e.getIn(["conversations","isLoading"],!0),hasMore:e.getIn(["conversations","hasMore"],!1)}},function(e){return{onLoadMore:function(t){return e(Object(j.i)({maxId:t}))}}})(ee);n.d(t,"default",function(){return oe});var ae=Object(g.f)({title:{id:"column.direct",defaultMessage:"Direct messages"}}),oe=Object(b.connect)(function(e){return{hasUnread:e.getIn(["timelines","direct","unread"])>0,conversationsMode:e.getIn(["settings","direct","conversations"])}})(te=Object(g.g)(te=function(e){function t(){for(var t,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a))||this,Object(l.a)(Object(r.a)(t),"handlePin",function(){var e=t.props,n=e.columnId,a=e.dispatch;a(n?Object(O.h)(n):Object(O.e)("DIRECT",{}))}),Object(l.a)(Object(r.a)(t),"handleMove",function(e){var n=t.props,a=n.columnId;(0,n.dispatch)(Object(O.g)(a,e))}),Object(l.a)(Object(r.a)(t),"handleHeaderClick",function(){t.column.scrollTop()}),Object(l.a)(Object(r.a)(t),"setRef",function(e){t.column=e}),Object(l.a)(Object(r.a)(t),"handleLoadMoreTimeline",function(e){t.props.dispatch(Object(m.s)({maxId:e}))}),Object(l.a)(Object(r.a)(t),"handleLoadMoreConversations",function(e){t.props.dispatch(Object(j.i)({maxId:e}))}),Object(l.a)(Object(r.a)(t),"handleTimelineClick",function(){t.props.dispatch(Object(C.c)(["direct","conversations"],!1))}),Object(l.a)(Object(r.a)(t),"handleConversationsClick",function(){t.props.dispatch(Object(C.c)(["direct","conversations"],!0))}),t}Object(d.a)(t,e);var n=t.prototype;return n.componentDidMount=function(){var e=this.props,t=e.dispatch,n=e.conversationsMode;t(Object(j.k)()),t(n?Object(j.i)():Object(m.s)()),this.disconnect=t(Object(w.b)())},n.componentDidUpdate=function(e){var t=this.props,n=t.dispatch,a=t.conversationsMode;e.conversationsMode&&!a?n(Object(m.s)()):!e.conversationsMode&&a&&n(Object(j.i)())},n.componentWillUnmount=function(){this.props.dispatch(Object(j.l)()),this.disconnect&&(this.disconnect(),this.disconnect=null)},n.render=function(){var e,t=this.props,n=t.intl,a=t.hasUnread,o=t.columnId,s=t.multiColumn,i=t.conversationsMode,r=!!o;return e=i?Object(c.a)(ne,{trackScroll:!r,scrollKey:"direct_timeline-"+o,timelineId:"direct",onLoadMore:this.handleLoadMore,emptyMessage:Object(c.a)(g.b,{id:"empty_column.direct",defaultMessage:"You don't have any direct messages yet. When you send or receive one, it will show up here."})}):Object(c.a)(h.a,{trackScroll:!r,scrollKey:"direct_timeline-"+o,timelineId:"direct",onLoadMore:this.handleLoadMoreTimeline,emptyMessage:Object(c.a)(g.b,{id:"empty_column.direct",defaultMessage:"You don't have any direct messages yet. When you send or receive one, it will show up here."})}),p.a.createElement(v.a,{ref:this.setRef,label:n.formatMessage(ae.title)},Object(c.a)(f.a,{icon:"envelope",active:a,title:n.formatMessage(ae.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:r,multiColumn:s},void 0,Object(c.a)(k,{})),Object(c.a)("div",{className:"notification__filter-bar"},void 0,Object(c.a)("button",{className:i?"active":"",onClick:this.handleConversationsClick},void 0,Object(c.a)(g.b,{id:"direct.conversations_mode",defaultMessage:"Conversations"})),Object(c.a)("button",{className:i?"":"active",onClick:this.handleTimelineClick},void 0,Object(c.a)(g.b,{id:"direct.timeline_mode",defaultMessage:"Timeline"}))),e)},t}(p.a.PureComponent))||te)||te}}]);
//# sourceMappingURL=direct_timeline.js.map