pleroma/priv/static/packs/flavours/glitch/async/report_modal.js
2019-06-26 21:06:28 +02:00

2 lines
5.4 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[75],{701:function(e,t,a){"use strict";a.r(t);var n,o,i,d=a(0),r=a(2),s=a(6),c=a(1),l=a(3),u=a.n(l),p=a(21),b=a(93),g=a(34),h=a(5),m=a.n(h),v=a(26),O=a.n(v),j=a(191),f=a(7),w=a(362),_=a.n(w),y=a(983),C=a.n(y),k=a(135),I=a(40),M=a(355),N=function(e){function t(){return e.apply(this,arguments)||this}return Object(s.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.status,a=e.checked,n=e.onToggle,o=e.disabled,i=null;if(t.get("reblog"))return null;if(0<t.get("media_attachments").size)if(t.get("media_attachments").some(function(e){return"unknown"===e.get("type")}));else if("video"===t.getIn(["media_attachments",0,"type"])){var r=t.getIn(["media_attachments",0]);i=Object(d.a)(M.a,{fetchComponent:I.L,loading:this.renderLoadingVideoPlayer},void 0,function(e){return Object(d.a)(e,{preview:r.get("preview_url"),src:r.get("url"),alt:r.get("description"),width:239,height:110,inline:!0,sensitive:t.get("sensitive"),revealed:!1,onOpenVideo:C.a})})}else i=Object(d.a)(M.a,{fetchComponent:I.z,loading:this.renderLoadingMediaGallery},void 0,function(e){return Object(d.a)(e,{media:t.get("media_attachments"),sensitive:t.get("sensitive"),revealed:!1,height:110,onOpenMedia:C.a})});return Object(d.a)("div",{className:"status-check-box"},void 0,Object(d.a)("div",{className:"status-check-box__status"},void 0,Object(d.a)(k.a,{status:t,media:i})),Object(d.a)("div",{className:"status-check-box-toggle"},void 0,Object(d.a)(_.a,{checked:a,onChange:n,disabled:o})))},t}(u.a.PureComponent),S=a(4),x=Object(p.connect)(function(e,t){var a=t.id;return{status:e.getIn(["statuses",a]),checked:e.getIn(["reports","new","status_ids"],Object(S.Set)()).includes(a)}},function(t,e){var a=e.id;return{onToggle:function(e){t(Object(b.m)(a,e.target.checked))}}})(N),R=a(25),F=a(82),K=a(48);a.d(t,"default",function(){return q});var T=Object(f.f)({close:{id:"lightbox.close",defaultMessage:"Close"},placeholder:{id:"report.placeholder",defaultMessage:"Additional comments"},submit:{id:"report.submit",defaultMessage:"Submit"}}),q=Object(p.connect)(function(){var a=Object(j.d)();return function(e){var t=e.getIn(["reports","new","account_id"]);return{isSubmitting:e.getIn(["reports","new","isSubmitting"]),account:a(e,t),comment:e.getIn(["reports","new","comment"]),forward:e.getIn(["reports","new","forward"]),statusIds:Object(S.OrderedSet)(e.getIn(["timelines","account:"+t+":with_replies","items"])).union(e.getIn(["reports","new","status_ids"]))}}})(n=Object(f.g)((i=o=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(c.a)(Object(r.a)(t),"handleCommentChange",function(e){t.props.dispatch(Object(b.i)(e.target.value))}),Object(c.a)(Object(r.a)(t),"handleForwardChange",function(e){t.props.dispatch(Object(b.j)(e.target.checked))}),Object(c.a)(Object(r.a)(t),"handleSubmit",function(){t.props.dispatch(Object(b.l)())}),Object(c.a)(Object(r.a)(t),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&t.handleSubmit()}),t}Object(s.a)(e,o);var t=e.prototype;return t.componentDidMount=function(){this.props.dispatch(Object(g.p)(this.props.account.get("id"),{withReplies:!0}))},t.componentWillReceiveProps=function(e){this.props.account!==e.account&&e.account&&this.props.dispatch(Object(g.p)(e.account.get("id"),{withReplies:!0}))},t.render=function(){var e=this.props,t=e.account,a=e.comment,n=e.intl,o=e.statusIds,i=e.isSubmitting,r=e.forward,s=e.onClose;if(!t)return null;var c=t.get("acct").split("@")[1];return Object(d.a)("div",{className:"modal-root__modal report-modal"},void 0,Object(d.a)("div",{className:"report-modal__target"},void 0,Object(d.a)(K.a,{className:"media-modal__close",title:n.formatMessage(T.close),icon:"times",onClick:s,size:16}),Object(d.a)(f.b,{id:"report.target",defaultMessage:"Report {target}",values:{target:Object(d.a)("strong",{},void 0,t.get("acct"))}})),Object(d.a)("div",{className:"report-modal__container"},void 0,Object(d.a)("div",{className:"report-modal__comment"},void 0,Object(d.a)("p",{},void 0,Object(d.a)(f.b,{id:"report.hint",defaultMessage:"The report will be sent to your server moderators. You can provide an explanation of why you are reporting this account below:"})),Object(d.a)("textarea",{className:"setting-text light",placeholder:n.formatMessage(T.placeholder),value:a,onChange:this.handleCommentChange,onKeyDown:this.handleKeyDown,disabled:i,autoFocus:!0}),c&&Object(d.a)("div",{},void 0,Object(d.a)("p",{},void 0,Object(d.a)(f.b,{id:"report.forward_hint",defaultMessage:"The account is from another server. Send an anonymized copy of the report there as well?"})),Object(d.a)("div",{className:"setting-toggle"},void 0,Object(d.a)(_.a,{id:"report-forward",checked:r,disabled:i,onChange:this.handleForwardChange}),Object(d.a)("label",{htmlFor:"report-forward",className:"setting-toggle__label"},void 0,Object(d.a)(f.b,{id:"report.forward",defaultMessage:"Forward to {target}",values:{target:c}})))),Object(d.a)(F.a,{disabled:i,text:n.formatMessage(T.submit),onClick:this.handleSubmit})),Object(d.a)("div",{className:"report-modal__statuses"},void 0,Object(d.a)("div",{},void 0,o.map(function(e){return Object(d.a)(x,{id:e,disabled:i},e)})))))},e}(R.a),Object(c.a)(o,"propTypes",{isSubmitting:m.a.bool,account:O.a.map,statusIds:O.a.orderedSet.isRequired,comment:m.a.string.isRequired,forward:m.a.bool,dispatch:m.a.func.isRequired,intl:m.a.object.isRequired}),n=i))||n)||n}}]);
//# sourceMappingURL=report_modal.js.map