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

2 lines
19 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[75],{738:function(t,e,n){"use strict";n.r(e);var i=n(0),o=n(2),a=n(7),s=n(1),c=n(63),l=n.n(c),r=n(3),d=n.n(r),u=n(12),f=n(667),h=n(664),b=n(43),g=n(243),p=n(148),O=n(5),j=n.n(O),m=n(18),v=n.n(m),M=n(19),C=n(999),w=n(6),_=n(287),P=n(218),y=n(459),k=n(686),I=n(25),x=function(t){function e(){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}Object(a.a)(e,t);var n=e.prototype;return n.getHandlers=function(){return{moveUp:this.handleMoveUp,moveDown:this.handleMoveDown,open:this.handleOpen,openProfile:this.handleOpenProfile,mention:this.handleMention,reply:this.handleMention}},n.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)(P.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)(_.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)(I.a,{fixedWidth:!0,id:"user-plus"})),Object(i.a)(w.b,{id:"notification.follow",defaultMessage:"{name} followed you",values:{name:s}})),Object(i.a)(y.a,{hidden:o,id:e.get("id"),withNote:!1}),Object(i.a)(k.a,{notification:n})))},e}(M.a);Object(s.a)(x,"propTypes",{hidden:j.a.bool,id:j.a.string.isRequired,account:v.a.map.isRequired,notification:v.a.map.isRequired});var N=function(t){function e(){return t.apply(this,arguments)||this}return Object(a.a)(e,t),e.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)(x,{hidden:e,id:n.get("id"),account:n.get("account"),notification:n,onMoveDown:o,onMoveUp:a,onMention:s});case"mention":return Object(i.a)(C.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)(C.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)(C.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)(C.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}},e}(M.a);Object(s.a)(N,"propTypes",{notification:v.a.map.isRequired,hidden:j.a.bool,onMoveUp:j.a.func.isRequired,onMoveDown:j.a.func.isRequired,onMention:j.a.func.isRequired,getScrollPosition:j.a.func,updateScrollBottom:j.a.func,cacheMediaWidth:j.a.func,cachedMediaWidth:j.a.number,onUnmount:j.a.func});var S,U,W,D,F=n(16),T=Object(u.connect)(function(){var t=Object(p.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(F.hb)(e,n))}}})(N),q=function(t){function e(){return t.apply(this,arguments)||this}return Object(a.a)(e,t),e.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)(I.a,{id:"eraser"})," ",Object(i.a)(w.b,{id:"notifications.clear",defaultMessage:"Clear notifications"}))},e}(d.a.Component),L=n(1013),A=function(t){function e(){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 Object(a.a)(e,t),e.prototype.render=function(){var t=this.props,e=t.settings,n=t.pushSettings,o=t.onChange,a=t.onClear,s=Object(i.a)(w.b,{id:"notifications.column_settings.filter_bar.show",defaultMessage:"Show"}),c=Object(i.a)(w.b,{id:"notifications.column_settings.filter_bar.advanced",defaultMessage:"Display all categories"}),l=Object(i.a)(w.b,{id:"notifications.column_settings.alert",defaultMessage:"Desktop notifications"}),r=Object(i.a)(w.b,{id:"notifications.column_settings.show",defaultMessage:"Show in column"}),d=Object(i.a)(w.b,{id:"notifications.column_settings.sound",defaultMessage:"Play sound"}),u=n.get("browserSupport")&&n.get("isSubscribed"),f=u&&Object(i.a)(w.b,{id:"notifications.column_settings.push",defaultMessage:"Push notifications"}),h=u&&Object(i.a)(w.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)(q,{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)(w.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)(L.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","show"],onChange:o,label:s}),Object(i.a)(L.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)(w.b,{id:"notifications.column_settings.follow",defaultMessage:"New followers:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(L.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow"],onChange:o,label:l}),u&&Object(i.a)(L.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","follow"],meta:h,onChange:this.onPushChange,label:f}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["shows","follow"],onChange:o,label:r}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow"],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)(w.b,{id:"notifications.column_settings.favourite",defaultMessage:"Favourites:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(L.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","favourite"],onChange:o,label:l}),u&&Object(i.a)(L.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","favourite"],meta:h,onChange:this.onPushChange,label:f}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["shows","favourite"],onChange:o,label:r}),Object(i.a)(L.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)(w.b,{id:"notifications.column_settings.mention",defaultMessage:"Mentions:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(L.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","mention"],onChange:o,label:l}),u&&Object(i.a)(L.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","mention"],meta:h,onChange:this.onPushChange,label:f}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["shows","mention"],onChange:o,label:r}),Object(i.a)(L.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)(w.b,{id:"notifications.column_settings.reblog",defaultMessage:"Boosts:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(L.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","reblog"],onChange:o,label:l}),u&&Object(i.a)(L.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","reblog"],meta:h,onChange:this.onPushChange,label:f}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["shows","reblog"],onChange:o,label:r}),Object(i.a)(L.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)(w.b,{id:"notifications.column_settings.poll",defaultMessage:"Poll results:"})),Object(i.a)("div",{className:"column-settings__row"},void 0,Object(i.a)(L.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","poll"],onChange:o,label:l}),u&&Object(i.a)(L.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","poll"],meta:h,onChange:this.onPushChange,label:f}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["shows","poll"],onChange:o,label:r}),Object(i.a)(L.a,{prefix:"notifications",settings:e,settingPath:["sounds","poll"],onChange:o,label:d}))))},e}(d.a.PureComponent),B=n(71),R=n(221),H=n(42),z=Object(w.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"}}),E=Object(w.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(R.e)(e.slice(1),n)):"quickFilter"===e[0]?(t(Object(B.c)(["notifications"].concat(e),n)),t(Object(b.B)("all"))):t(Object(B.c)(["notifications"].concat(e),n))},onClear:function(){t(Object(H.d)("CONFIRM",{message:n.formatMessage(z.clearMessage),confirm:n.formatMessage(z.clearConfirm),onConfirm:function(){return t(Object(b.r)())}}))}}})(A)),G=Object(w.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"}}),J=Object(w.g)(S=function(t){function e(){return t.apply(this,arguments)||this}Object(a.a)(e,t);var n=e.prototype;return n.onClick=function(t){var e=this;return function(){return e.props.selectFilter(t)}},n.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)(w.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(i.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention"),title:o.formatMessage(G.mentions)},void 0,Object(i.a)(I.a,{id:"reply-all",fixedWidth:!0})),Object(i.a)("button",{className:"favourite"===e?"active":"",onClick:this.onClick("favourite"),title:o.formatMessage(G.favourites)},void 0,Object(i.a)(I.a,{id:"star",fixedWidth:!0})),Object(i.a)("button",{className:"reblog"===e?"active":"",onClick:this.onClick("reblog"),title:o.formatMessage(G.boosts)},void 0,Object(i.a)(I.a,{id:"retweet",fixedWidth:!0})),Object(i.a)("button",{className:"poll"===e?"active":"",onClick:this.onClick("poll"),title:o.formatMessage(G.polls)},void 0,Object(i.a)(I.a,{id:"tasks",fixedWidth:!0})),Object(i.a)("button",{className:"follow"===e?"active":"",onClick:this.onClick("follow"),title:o.formatMessage(G.follows)},void 0,Object(i.a)(I.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)(w.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(i.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention")},void 0,Object(i.a)(w.b,{id:"notifications.filter.mentions",defaultMessage:"Mentions"})))},e}(d.a.PureComponent))||S,K=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(b.B)(e))}}})(J),V=n(53),Q=n(4),Y=n(963),X=n(1060);n.d(e,"default",function(){return tt});var Z=Object(w.f)({title:{id:"column.notifications",defaultMessage:"Notifications"}}),$=Object(V.a)([function(t){return t.getIn(["settings","notifications","quickFilter","show"])},function(t){return t.getIn(["settings","notifications","quickFilter","active"])},function(t){return Object(Q.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"))})}),tt=Object(u.connect)(function(t){return{showFilterBar:t.getIn(["settings","notifications","quickFilter","show"]),notifications:$(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(Q.List)()).size,notifCleaningActive:t.getIn(["notifications","cleaningMode"])}},function(t){return{onEnterCleaningMode:function(e){t(Object(b.t)(e))},onMount:function(){t(Object(b.y)())},onUnmount:function(){t(Object(b.C)())},dispatch:t}})(U=Object(w.g)((D=W=function(t){function e(){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),"handleLoadGap",function(t){e.props.dispatch(Object(b.u)({maxId:t}))}),Object(s.a)(Object(o.a)(e),"handleLoadOlder",l()(function(){var t=e.props.notifications.last();e.props.dispatch(Object(b.u)({maxId:t&&t.get("id")}))},300,{leading:!0})),Object(s.a)(Object(o.a)(e),"handleLoadPending",function(){e.props.dispatch(Object(b.v)())}),Object(s.a)(Object(o.a)(e),"handleScrollToTop",l()(function(){e.props.dispatch(Object(b.A)(!0))},100)),Object(s.a)(Object(o.a)(e),"handleScroll",l()(function(){e.props.dispatch(Object(b.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(g.h)(n):Object(g.e)("NOTIFICATIONS",{}))}),Object(s.a)(Object(o.a)(e),"handleMove",function(t){var n=e.props,i=n.columnId;(0,n.dispatch)(Object(g.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)}),e}Object(a.a)(e,t);var n=e.prototype;return n._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())},n.componentDidMount=function(){var t=this.props.onMount;t&&t()},n.componentWillUnmount=function(){var t=this.props.onUnmount;t&&t()},n.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,b=e.numPending,g=e.showFilterBar,p=!!l,O=Object(i.a)(w.b,{id:"empty_column.notifications",defaultMessage:"You don't have any notifications yet. Interact with others to start the conversation."}),j=null,m=g?Object(i.a)(K,{}):null;j=s&&this.scrollableContent?this.scrollableContent:o.size>0||u?o.map(function(e,n){return null===e?Object(i.a)(X.a,{disabled:s,maxId:n>0?o.getIn([n-1,"id"]):null,onClick:t.handleLoadGap},"gap:"+o.getIn([n+1,"id"])):Object(i.a)(T,{notification:e,accountId:e.get("account"),onMoveUp:t.handleMoveUp,onMoveDown:t.handleMoveDown},e.get("id"))}):null,this.scrollableContent=j;var v=Object(i.a)(Y.a,{scrollKey:"notifications-"+l,trackScroll:!p,isLoading:s,showLoading:s&&0===o.size,hasMore:u,numPending:b,emptyMessage:O,onLoadMore:this.handleLoadOlder,onLoadPending:this.handleLoadPending,onScrollToTop:this.handleScrollToTop,onScroll:this.handleScroll,shouldUpdateScroll:a},void 0,j);return d.a.createElement(f.a,{ref:this.setColumnRef,name:"notifications",extraClasses:this.props.notifCleaningActive?"notif-cleaning":null,label:n.formatMessage(Z.title)},Object(i.a)(h.a,{icon:"bell",active:c,title:n.formatMessage(Z.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:p,multiColumn:r,localSettings:this.props.localSettings,notifCleaning:!0,notifCleaningActive:this.props.notifCleaningActive,onEnterCleaningMode:this.props.onEnterCleaningMode},void 0,Object(i.a)(E,{})),m,v)},e}(d.a.PureComponent),Object(s.a)(W,"defaultProps",{trackScroll:!0}),U=D))||U)||U}}]);
//# sourceMappingURL=notifications.js.map