honkoma/priv/static/packs/flavours/glitch/async/notifications.js

2 lines
26 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[77],{833:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return vt}));var i=n(0),o=n(2),a=(n(9),n(6),n(8)),s=n(1),c=n(65),l=n.n(c),r=n(3),d=n.n(r),u=n(15),f=n(14),b=n.n(f),h=n(760),g=n(758),p=n(43),O=n(252),j=n(108),v=n(5),m=n.n(v),M=n(16),_=n.n(M),C=n(21),w=n(1085),y=n(7),N=n(301),k=n(214),P=n(471),I=n(771),x=n(25);var D=function(t){Object(a.a)(n,t);var e;e=n;function n(){for(var e,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=t.call.apply(t,[this].concat(i))||this,Object(s.a)(Object(o.a)(e),"handleMoveUp",(function(){var t=e.props,n=t.notification;(0,t.onMoveUp)(n.get("id"))})),Object(s.a)(Object(o.a)(e),"handleMoveDown",(function(){var t=e.props,n=t.notification;(0,t.onMoveDown)(n.get("id"))})),Object(s.a)(Object(o.a)(e),"handleOpen",(function(){e.handleOpenProfile()})),Object(s.a)(Object(o.a)(e),"handleOpenProfile",(function(){var t=e.props.notification;e.context.router.history.push("/accounts/"+t.getIn(["account","id"]))})),Object(s.a)(Object(o.a)(e),"handleMention",(function(t){t.preventDefault();var n=e.props,i=n.notification;(0,n.onMention)(i.get("account"),e.context.router.history)})),e}var c=n.prototype;return c.getHandlers=function(){return{moveUp:this.handleMoveUp,moveDown:this.handleMoveDown,open:this.handleOpen,openProfile:this.handleOpenProfile,mention:this.handleMention,reply:this.handleMention}},c.render=function(){var t=this.props,e=t.account,n=t.notification,o=t.hidden,a=e.get("display_name_html")||e.get("username"),s=Object(i.a)("bdi",{},void 0,Object(i.a)(k.a,{className:"notification__display-name",href:e.get("url"),title:e.get("acct"),to:"/accounts/"+e.get("id"),dangerouslySetInnerHTML:{__html:a}}));return Object(i.a)(N.HotKeys,{handlers:this.getHandlers()},void 0,Object(i.a)("div",{className:"notification notification-follow focusable",tabIndex:"0"},void 0,Object(i.a)("div",{className:"notification__message"},void 0,Object(i.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(i.a)(x.a,{fixedWidth:!0,id:"user-plus"})),Object(i.a)(y.b,{id:"notification.follow",defaultMessage:"{name} followed you",values:{name:s}})),Object(i.a)(P.a,{hidden:o,id:e.get("id"),withNote:!1}),Object(i.a)(I.a,{notification:n})))},n}(C.a);Object(s.a)(D,"propTypes",{hidden:m.a.bool,id:m.a.string.isRequired,account:_.a.map.isRequired,notification:_.a.map.isRequired});var q,S,U,A=n(96),T=n(98),W=n(41);var F=Object(y.f)({authorize:{id:"follow_request.authorize",defaultMessage:"Authorize"},reject:{id:"follow_request.reject",defaultMessage:"Reject"}}),R=Object(y.g)((U=S=function(t){Object(a.a)(n,t);var e;e=n;function n(){for(var e,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=t.call.apply(t,[this].concat(i))||this,Object(s.a)(Object(o.a)(e),"handleMoveUp",(function(){var t=e.props,n=t.notification;(0,t.onMoveUp)(n.get("id"))})),Object(s.a)(Object(o.a)(e),"handleMoveDown",(function(){var t=e.props,n=t.notification;(0,t.onMoveDown)(n.get("id"))})),Object(s.a)(Object(o.a)(e),"handleOpen",(function(){e.handleOpenProfile()})),Object(s.a)(Object(o.a)(e),"handleOpenProfile",(function(){var t=e.props.notification;e.context.router.history.push("/accounts/"+t.getIn(["account","id"]))})),Object(s.a)(Object(o.a)(e),"handleMention",(function(t){t.preventDefault();var n=e.props,i=n.notification;(0,n.onMention)(i.get("account"),e.context.router.history)})),e}var c=n.prototype;return c.getHandlers=function(){return{moveUp:this.handleMoveUp,moveDown:this.handleMoveDown,open:this.handleOpen,openProfile:this.handleOpenProfile,mention:this.handleMention,reply:this.handleMention}},c.render=function(){var t=this.props,e=t.intl,n=t.hidden,o=t.account,a=t.onAuthorize,s=t.onReject,c=t.notification;if(!o)return Object(i.a)("div",{});if(n)return Object(i.a)(r.Fragment,{},void 0,o.get("display_name"),o.get("username"));var l=o.get("display_name_html")||o.get("username"),d=Object(i.a)("bdi",{},void 0,Object(i.a)(k.a,{className:"notification__display-name",href:o.get("url"),title:o.get("acct"),to:"/accounts/"+o.get("id"),dangerouslySetInnerHTML:{__html:l}}));return Object(i.a)(N.HotKeys,{handlers:this.getHandlers()},void 0,Object(i.a)("div",{className:"notification notification-follow-request focusable",tabIndex:"0"},void 0,Object(i.a)("div",{className:"notification__message"},void 0,Object(i.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(i.a)(x.a,{id:"user",fixedWidth:!0})),Object(i.a)(y.b,{id:"notification.follow_request",defaultMessage:"{name} has requested to follow you",values:{name:d}})),Object(i.a)("div",{className:"account"},void 0,Object(i.a)("div",{className:"account__wrapper"},void 0,Object(i.a)(k.a,{className:"account__display-name",title:o.get("acct"),href:o.get("url"),to:"/accounts/"+o.get("id")},o.get("id"),Object(i.a)("div",{className:"account__avatar-wrapper"},void 0,Object(i.a)(A.a,{account:o,size:36})),Object(i.a)(T.a,{account:o})),Object(i.a)("div",{className:"account__relationship"},void 0,Object(i.a)(W.a,{title:e.formatMessage(F.authorize),icon:"check",onClick:a}),Object(i.a)(W.a,{title:e.formatMessage(F.reject),icon:"times",onClick:s})))),Object(i.a)(I.a,{notification:c})))},n}(C.a),Object(s.a)(S,"propTypes",{account:_.a.map.isRequired,onAuthorize:m.a.func.isRequired,onReject:m.a.func.isRequired,intl:m.a.object.isRequired,notification:_.a.map.isRequired}),q=U))||q,L=n(24),B=Object(u.connect)(null,(function(t,e){var n=e.account;return{onAuthorize:function(){t(Object(L.y)(n.get("id")))},onReject:function(){t(Object(L.P)(n.get("id")))}}}))(R);var z=function(t){Object(a.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}return n.prototype.render=function(){var t=this.props,e=t.hidden,n=t.notification,o=t.onMoveDown,a=t.onMoveUp,s=t.onMention,c=t.getScrollPosition,l=t.updateScrollBottom;switch(n.get("type")){case"follow":return Object(i.a)(D,{hidden:e,id:n.get("id"),account:n.get("account"),notification:n,onMoveDown:o,onMoveUp:a,onMention:s});case"follow_request":return Object(i.a)(B,{hidden:e,id:n.get("id"),account:n.get("account"),notification:n,onMoveDown:o,onMoveUp:a,onMention:s});case"mention":return Object(i.a)(w.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),notification:n,onMoveDown:o,onMoveUp:a,onMention:s,contextType:"notifications",getScrollPosition:c,updateScrollBottom:l,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"favourite":return Object(i.a)(w.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"favourite",muted:!0,notification:n,onMoveDown:o,onMoveUp:a,onMention:s,getScrollPosition:c,updateScrollBottom:l,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"reblog":return Object(i.a)(w.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"reblog",muted:!0,notification:n,onMoveDown:o,onMoveUp:a,onMention:s,getScrollPosition:c,updateScrollBottom:l,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"poll":return Object(i.a)(w.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"poll",muted:!0,notification:n,onMoveDown:o,onMoveUp:a,onMention:s,getScrollPosition:c,updateScrollBottom:l,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});default:return null}},n}(C.a);Object(s.a)(z,"propTypes",{notification:_.a.map.isRequired,hidden:m.a.bool,onMoveUp:m.a.func.isRequired,onMoveDown:m.a.func.isRequired,onMention:m.a.func.isRequired,getScrollPosition:m.a.func,updateScrollBottom:m.a.func,cacheMediaWidth:m.a.func,cachedMediaWidth:m.a.number,onUnmount:m.a.func});var H=n(20),E=Object(u.connect)((function(){var t=Object(j.e)();return function(e,n){return{notification:t(e,n.notification,n.accountId),notifCleaning:e.getIn(["notifications","cleaningMode"])}}}),(function(t){return{onMention:function(e,n){t(Object(H.hb)(e,n))}}}))(z);var K=function(t){Object(a.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}return n.prototype.render=function(){return Object(i.a)("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.props.onClick},void 0,Object(i.a)(x.a,{id:"eraser"})," ",Object(i.a)(y.b,{id:"notifications.clear",defaultMessage:"Clear notifications"}))},n}(d.a.Component),G=n(1101);var J,V=function(t){Object(a.a)(n,t);var e;e=n;function n(){for(var e,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=t.call.apply(t,[this].concat(i))||this,Object(s.a)(Object(o.a)(e),"onPushChange",(function(t,n){e.props.onChange(["push"].concat(t),n)})),e}return n.prototype.render=function(){var t=this.props,e=t.settings,n=t.pushSettings,o=t.onChange,a=t.onClear,s=Object(i.a)(y.b,{id:"notifications.column_settings.filter_bar.show",defaultMessage:"Show"}),c=Object(i.a)(y.b,{id:"notifications.column_settings.filter_bar.advanced",defaultMessage:"Display all categories"}),l=Object(i.a)(y.b,{id:"notifications.column_settings.alert",defaultMessage:"Desktop notifications"}),r=Object(i.a)(y.b,{id:"notifications.column_settings.show",defaultMessage:"Show in column"}),d=Object(i.a)(y.b,{id:"notifications.column_settings.sound",defaultMessage:"Play sound"}),u=n.get("browserSupport")&&n.get("isSubscribed"),f=u&&Object(i.a)(y.b,{id:"notifications.column_settings.push",defaultMessage:"Push notifications"}),b=u&&Object(i.a)(y.b,{id:"notifications.column_settings.push_meta",defaultMessage:"This device"});return Object(i.a)("div",{},void 0,Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(K,{onClick:a})),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-filter-bar"},void 0,Object(i.a)("span",{id:"notifications-filter-bar",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.filter_bar.category",defaultMessage:"Quick filter bar"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","show"],onChange:o,label:s}),Object(i.a)(G.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","advanced"],onChange:o,label:c}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-follow"},void 0,Object(i.a)("span",{id:"notifications-follow",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.follow",defaultMessage:"New followers:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","follow"],meta:b,onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","follow"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow"],onChange:o,label:d}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-follow-request"},void 0,Object(i.a)("span",{id:"notifications-follow-request",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.follow_request",defaultMessage:"New follow requests:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow_request"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","follow_request"],onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","follow_request"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow_request"],onChange:o,label:d}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-favourite"},void 0,Object(i.a)("span",{id:"notifications-favourite",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.favourite",defaultMessage:"Favourites:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","favourite"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","favourite"],meta:b,onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","favourite"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","favourite"],onChange:o,label:d}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-mention"},void 0,Object(i.a)("span",{id:"notifications-mention",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.mention",defaultMessage:"Mentions:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","mention"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","mention"],meta:b,onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","mention"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","mention"],onChange:o,label:d}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-reblog"},void 0,Object(i.a)("span",{id:"notifications-reblog",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.reblog",defaultMessage:"Boosts:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","reblog"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","reblog"],meta:b,onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","reblog"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","reblog"],onChange:o,label:d}))),Object(i.a)("div",{role:"group","aria-labelledby":"notifications-poll"},void 0,Object(i.a)("span",{id:"notifications-poll",className:"column-settings__section"},void 0,Object(i.a)(y.b,{id:"notifications.column_settings.poll",defaultMessage:"Poll results:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(G.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","poll"],onChange:o,label:l}),u&&Object(i.a)(G.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","poll"],meta:b,onChange:this.onPushChange,label:f}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["shows","poll"],onChange:o,label:r}),Object(i.a)(G.a,{prefix:"notifications",settings:e,settingPath:["sounds","poll"],onChange:o,label:d}))))},n}(d.a.PureComponent),Q=n(73),Y=n(232),X=n(45),Z=Object(y.f)({clearMessage:{id:"notifications.clear_confirmation",defaultMessage:"Are you sure you want to permanently clear all your notifications?"},clearConfirm:{id:"notifications.clear",defaultMessage:"Clear notifications"}}),$=Object(y.g)(Object(u.connect)((function(t){return{settings:t.getIn(["settings","notifications"]),pushSettings:t.get("push_notifications")}}),(function(t,e){var n=e.intl;return{onChange:function(e,n){"push"===e[0]?t(Object(Y.e)(e.slice(1),n)):"quickFilter"===e[0]?(t(Object(Q.c)(["notifications"].concat(e),n)),t(Object(p.B)("all"))):t(Object(Q.c)(["notifications"].concat(e),n))},onClear:function(){t(Object(X.d)("CONFIRM",{message:n.formatMessage(Z.clearMessage),confirm:n.formatMessage(Z.clearConfirm),onConfirm:function(){return t(Object(p.r)())}}))}}}))(V));var tt,et,nt,it=Object(y.f)({mentions:{id:"notifications.filter.mentions",defaultMessage:"Mentions"},favourites:{id:"notifications.filter.favourites",defaultMessage:"Favourites"},boosts:{id:"notifications.filter.boosts",defaultMessage:"Boosts"},polls:{id:"notifications.filter.polls",defaultMessage:"Poll results"},follows:{id:"notifications.filter.follows",defaultMessage:"Follows"}}),ot=Object(y.g)(J=function(t){Object(a.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}var o=n.prototype;return o.onClick=function(t){var e=this;return function(){return e.props.selectFilter(t)}},o.render=function(){var t=this.props,e=t.selectedFilter,n=t.advancedMode,o=t.intl;return n?Object(i.a)("div",{className:"notification__filter-bar"},void 0,Object(i.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(i.a)(y.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(i.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention"),title:o.formatMessage(it.mentions)},void 0,Object(i.a)(x.a,{id:"reply-all",fixedWidth:!0})),Object(i.a)("button",{className:"favourite"===e?"active":"",onClick:this.onClick("favourite"),title:o.formatMessage(it.favourites)},void 0,Object(i.a)(x.a,{id:"star",fixedWidth:!0})),Object(i.a)("button",{className:"reblog"===e?"active":"",onClick:this.onClick("reblog"),title:o.formatMessage(it.boosts)},void 0,Object(i.a)(x.a,{id:"retweet",fixedWidth:!0})),Object(i.a)("button",{className:"poll"===e?"active":"",onClick:this.onClick("poll"),title:o.formatMessage(it.polls)},void 0,Object(i.a)(x.a,{id:"tasks",fixedWidth:!0})),Object(i.a)("button",{className:"follow"===e?"active":"",onClick:this.onClick("follow"),title:o.formatMessage(it.follows)},void 0,Object(i.a)(x.a,{id:"user-plus",fixedWidth:!0}))):Object(i.a)("div",{className:"notification__filter-bar"},void 0,Object(i.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(i.a)(y.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(i.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention")},void 0,Object(i.a)(y.b,{id:"notifications.filter.mentions",defaultMessage:"Mentions"})))},n}(d.a.PureComponent))||J,at=Object(u.connect)((function(t){return{selectedFilter:t.getIn(["settings","notifications","quickFilter","active"]),advancedMode:t.getIn(["settings","notifications","quickFilter","advanced"])}}),(function(t){return{selectFilter:function(e){t(Object(p.B)(e))}}}))(ot),st=n(57),ct=n(4),lt=n(1048),rt=n(1146);var dt,ut,ft,bt=Object(y.f)({btnAll:{id:"notification_purge.btn_all",defaultMessage:"Select\nall"},btnNone:{id:"notification_purge.btn_none",defaultMessage:"Select\nnone"},btnInvert:{id:"notification_purge.btn_invert",defaultMessage:"Invert\nselection"},btnApply:{id:"notification_purge.btn_apply",defaultMessage:"Clear\nselected"}}),ht=Object(y.g)((nt=et=function(t){Object(a.a)(n,t);var e;e=n;function n(){return t.apply(this,arguments)||this}return n.prototype.render=function(){var t=this.props,e=t.intl,n=t.markNewForDelete;return(Object(i.a)("div",{className:"column-header__notif-cleaning-buttons"},void 0,Object(i.a)("button",{onClick:this.props.onMarkAll,className:n?"active":""},void 0,Object(i.a)("b",{},void 0,"∀"),Object(i.a)("br",{}),e.formatMessage(bt.btnAll)),Object(i.a)("button",{onClick:this.props.onMarkNone,className:n?"":"active"},void 0,Object(i.a)("b",{},void 0,"∅"),Object(i.a)("br",{}),e.formatMessage(bt.btnNone)),Object(i.a)("button",{onClick:this.props.onInvert},void 0,Object(i.a)("b",{},void 0,"¬"),Object(i.a)("br",{}),e.formatMessage(bt.btnInvert)),Object(i.a)("button",{onClick:this.props.onDeleteMarked},void 0,Object(i.a)(x.a,{id:"trash"}),Object(i.a)("br",{}),e.formatMessage(bt.btnApply))))},n}(C.a),Object(s.a)(et,"propTypes",{onDeleteMarked:m.a.func.isRequired,onMarkAll:m.a.func.isRequired,onMarkNone:m.a.func.isRequired,onInvert:m.a.func.isRequired,intl:m.a.object.isRequired,markNewForDelete:m.a.bool}),tt=nt))||tt,gt=Object(y.f)({clearMessage:{id:"notifications.marked_clear_confirmation",defaultMessage:"Are you sure you want to permanently clear all selected notifications?"},clearConfirm:{id:"notifications.marked_clear",defaultMessage:"Clear selected notifications"}}),pt=Object(y.g)(Object(u.connect)((function(t){return{markNewForDelete:t.getIn(["notifications","markNewForDelete"])}}),(function(t,e){var n=e.intl;return{onEnterCleaningMode:function(e){t(Object(p.t)(e))},onDeleteMarked:function(){t(Object(X.d)("CONFIRM",{message:n.formatMessage(gt.clearMessage),confirm:n.formatMessage(gt.clearConfirm),onConfirm:function(){return t(Object(p.s)())}}))},onMarkAll:function(){t(Object(p.w)(!0))},onMarkNone:function(){t(Object(p.w)(!1))},onInvert:function(){t(Object(p.w)(null))}}}))(ht));var Ot=Object(y.f)({title:{id:"column.notifications",defaultMessage:"Notifications"},enterNotifCleaning:{id:"notification_purge.start",defaultMessage:"Enter notification cleaning mode"}}),jt=Object(st.a)([function(t){return t.getIn(["settings","notifications","quickFilter","show"])},function(t){return t.getIn(["settings","notifications","quickFilter","active"])},function(t){return Object(ct.List)(t.getIn(["settings","notifications","shows"]).filter((function(t){return!t})).keys())},function(t){return t.getIn(["notifications","items"])}],(function(t,e,n,i){return t&&"all"!==e?i.filter((function(t){return null!==t&&e===t.get("type")})):i.filterNot((function(t){return null!==t&&n.includes(t.get("type"))}))})),vt=Object(u.connect)((function(t){return{showFilterBar:t.getIn(["settings","notifications","quickFilter","show"]),notifications:jt(t),localSettings:t.get("local_settings"),isLoading:t.getIn(["notifications","isLoading"],!0),isUnread:t.getIn(["notifications","unread"])>0||t.getIn(["notifications","pendingItems"]).size>0,hasMore:t.getIn(["notifications","hasMore"]),numPending:t.getIn(["notifications","pendingItems"],Object(ct.List)()).size,notifCleaningActive:t.getIn(["notifications","cleaningMode"])}}),(function(t){return{onEnterCleaningMode:function(e){t(Object(p.t)(e))},onMount:function(){t(Object(p.y)())},onUnmount:function(){t(Object(p.C)())},dispatch:t}}))(dt=Object(y.g)((ft=ut=function(t){Object(a.a)(n,t);var e;e=n;function n(){for(var e,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=t.call.apply(t,[this].concat(i))||this,Object(s.a)(Object(o.a)(e),"state",{animatingNCD:!1}),Object(s.a)(Object(o.a)(e),"handleLoadGap",(function(t){e.props.dispatch(Object(p.u)({maxId:t}))})),Object(s.a)(Object(o.a)(e),"handleLoadOlder",l()((function(){var t=e.props.notifications.last();e.props.dispatch(Object(p.u)({maxId:t&&t.get("id")}))}),300,{leading:!0})),Object(s.a)(Object(o.a)(e),"handleLoadPending",(function(){e.props.dispatch(Object(p.v)())})),Object(s.a)(Object(o.a)(e),"handleScrollToTop",l()((function(){e.props.dispatch(Object(p.A)(!0))}),100)),Object(s.a)(Object(o.a)(e),"handleScroll",l()((function(){e.props.dispatch(Object(p.A)(!1))}),100)),Object(s.a)(Object(o.a)(e),"handlePin",(function(){var t=e.props,n=t.columnId,i=t.dispatch;i(n?Object(O.h)(n):Object(O.e)("NOTIFICATIONS",{}))})),Object(s.a)(Object(o.a)(e),"handleMove",(function(t){var n=e.props,i=n.columnId;(0,n.dispatch)(Object(O.g)(i,t))})),Object(s.a)(Object(o.a)(e),"handleHeaderClick",(function(){e.column.scrollTop()})),Object(s.a)(Object(o.a)(e),"setColumnRef",(function(t){e.column=t})),Object(s.a)(Object(o.a)(e),"handleMoveUp",(function(t){var n=e.props.notifications.findIndex((function(e){return null!==e&&e.get("id")===t}))-1;e._selectChild(n,!0)})),Object(s.a)(Object(o.a)(e),"handleMoveDown",(function(t){var n=e.props.notifications.findIndex((function(e){return null!==e&&e.get("id")===t}))+1;e._selectChild(n,!1)})),Object(s.a)(Object(o.a)(e),"handleTransitionEndNCD",(function(){e.setState({animatingNCD:!1})})),Object(s.a)(Object(o.a)(e),"onEnterCleaningMode",(function(){e.setState({animatingNCD:!0}),e.props.onEnterCleaningMode(!e.props.notifCleaningActive)})),e}var c=n.prototype;return c._selectChild=function(t,e){var n=this.column.node,i=n.querySelector("article:nth-of-type("+(t+1)+") .focusable");i&&(e&&n.scrollTop>i.offsetTop?i.scrollIntoView(!0):!e&&n.scrollTop+n.clientHeight<i.offsetTop+i.offsetHeight&&i.scrollIntoView(!1),i.focus())},c.componentDidMount=function(){var t=this.props.onMount;t&&t()},c.componentWillUnmount=function(){var t=this.props.onUnmount;t&&t()},c.render=function(){var t=this,e=this.props,n=e.intl,o=e.notifications,a=e.shouldUpdateScroll,s=e.isLoading,c=e.isUnread,l=e.columnId,r=e.multiColumn,u=e.hasMore,f=e.numPending,p=e.showFilterBar,O=this.props,j=(O.notifCleaning,O.notifCleaningActive),v=this.state.animatingNCD,m=!!l,M=Object(i.a)(y.b,{id:"empty_column.notifications",defaultMessage:"You don't have any notifications yet. Interact with others to start the conversation."}),_=null,C=p?Object(i.a)(at,{}):null;_=s&&this.scrollableContent?this.scrollableContent:o.size>0||u?o.map((function(e,n){return null===e?Object(i.a)(rt.a,{disabled:s,maxId:n>0?o.getIn([n-1,"id"]):null,onClick:t.handleLoadGap},"gap:"+o.getIn([n+1,"id"])):Object(i.a)(E,{notification:e,accountId:e.get("account"),onMoveUp:t.handleMoveUp,onMoveDown:t.handleMoveDown},e.get("id"))})):null,this.scrollableContent=_;var w=Object(i.a)(lt.a,{scrollKey:"notifications-"+l,trackScroll:!m,isLoading:s,showLoading:s&&0===o.size,hasMore:u,numPending:f,emptyMessage:M,onLoadMore:this.handleLoadOlder,onLoadPending:this.handleLoadPending,onScrollToTop:this.handleScrollToTop,onScroll:this.handleScroll,shouldUpdateScroll:a,bindToDocument:!r},void 0,_),N=b()("column-header__button",{active:j}),k=b()("ncd column-header__collapsible",{collapsed:!j,animating:v}),P=n.formatMessage(Ot.enterNotifCleaning),I=Object(i.a)("button",{"aria-label":P,title:P,onClick:this.onEnterCleaningMode,className:N},void 0,Object(i.a)(x.a,{id:"eraser"})),D=Object(i.a)("div",{className:k,onTransitionEnd:this.handleTransitionEndNCD},void 0,Object(i.a)("div",{className:"column-header__collapsible-inner nopad-drawer"},void 0,j||v?Object(i.a)(pt,{}):null));return d.a.createElement(h.a,{bindToDocument:!r,ref:this.setColumnRef,name:"notifications",extraClasses:this.props.notifCleaningActive?"notif-cleaning":null,label:n.formatMessage(Ot.title)},Object(i.a)(g.a,{icon:"bell",active:c,title:n.formatMessage(Ot.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:m,multiColumn:r,localSettings:this.props.localSettings,extraButton:I,appendContent:D},void 0,Object(i.a)($,{})),C,w)},n}(d.a.PureComponent),Object(s.a)(ut,"defaultProps",{trackScroll:!0}),dt=ft))||dt)||dt}}]);
//# sourceMappingURL=notifications.js.map