forked from AkkomaGang/akkoma
2 lines
No EOL
18 KiB
JavaScript
2 lines
No EOL
18 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[69],{690:function(t,e,n){"use strict";n.r(e);var p=n(0),a=n(2),i=n(6),s=n(1),o=n(56),c=n.n(o),l=n(3),O=n.n(l),r=n(21),j=n(632),m=n(627),d=n(41),f=n(221),u=n(191),b=n(5),h=n.n(b),g=n(26),v=n.n(g),M=n(25),C=n(911),w=n(7),_=n(343),y=n(317),P=n(630),k=n(645),N=function(o){function t(){for(var i,t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return i=o.call.apply(o,[this].concat(e))||this,Object(s.a)(Object(a.a)(i),"handleMoveUp",function(){var t=i.props,e=t.notification;(0,t.onMoveUp)(e.get("id"))}),Object(s.a)(Object(a.a)(i),"handleMoveDown",function(){var t=i.props,e=t.notification;(0,t.onMoveDown)(e.get("id"))}),Object(s.a)(Object(a.a)(i),"handleOpen",function(){i.handleOpenProfile()}),Object(s.a)(Object(a.a)(i),"handleOpenProfile",function(){var t=i.props.notification;i.context.router.history.push("/accounts/"+t.getIn(["account","id"]))}),Object(s.a)(Object(a.a)(i),"handleMention",function(t){t.preventDefault();var e=i.props,n=e.notification;(0,e.onMention)(n.get("account"),i.context.router.history)}),i}Object(i.a)(t,o);var e=t.prototype;return e.getHandlers=function(){return{moveUp:this.handleMoveUp,moveDown:this.handleMoveDown,open:this.handleOpen,openProfile:this.handleOpenProfile,mention:this.handleMention,reply:this.handleMention}},e.render=function(){var t=this.props,e=t.account,n=t.notification,i=t.hidden,o=e.get("display_name_html")||e.get("username"),a=Object(p.a)("bdi",{},void 0,Object(p.a)(y.a,{className:"notification__display-name",href:e.get("url"),title:e.get("acct"),to:"/accounts/"+e.get("id"),dangerouslySetInnerHTML:{__html:o}}));return Object(p.a)(_.HotKeys,{handlers:this.getHandlers()},void 0,Object(p.a)("div",{className:"notification notification-follow focusable",tabIndex:"0"},void 0,Object(p.a)("div",{className:"notification__message"},void 0,Object(p.a)("div",{className:"notification__favourite-icon-wrapper"},void 0,Object(p.a)("i",{className:"fa fa-fw fa-user-plus"})),Object(p.a)(w.b,{id:"notification.follow",defaultMessage:"{name} followed you",values:{name:a}})),Object(p.a)(P.a,{hidden:i,id:e.get("id"),withNote:!1}),Object(p.a)(k.a,{notification:n})))},t}(M.a);Object(s.a)(N,"propTypes",{hidden:h.a.bool,id:h.a.string.isRequired,account:v.a.map.isRequired,notification:v.a.map.isRequired});var I=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.render=function(){var t=this.props,e=t.hidden,n=t.notification,i=t.onMoveDown,o=t.onMoveUp,a=t.onMention,s=t.getScrollPosition,c=t.updateScrollBottom;switch(n.get("type")){case"follow":return Object(p.a)(N,{hidden:e,id:n.get("id"),account:n.get("account"),notification:n,onMoveDown:i,onMoveUp:o,onMention:a});case"mention":return Object(p.a)(C.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),notification:n,onMoveDown:i,onMoveUp:o,onMention:a,contextType:"notifications",getScrollPosition:s,updateScrollBottom:c,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"favourite":return Object(p.a)(C.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"favourite",muted:!0,notification:n,onMoveDown:i,onMoveUp:o,onMention:a,getScrollPosition:s,updateScrollBottom:c,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"reblog":return Object(p.a)(C.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"reblog",muted:!0,notification:n,onMoveDown:i,onMoveUp:o,onMention:a,getScrollPosition:s,updateScrollBottom:c,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});case"poll":return Object(p.a)(C.a,{containerId:n.get("id"),hidden:e,id:n.get("status"),account:n.get("account"),prepend:"poll",muted:!0,notification:n,onMoveDown:i,onMoveUp:o,onMention:a,getScrollPosition:s,updateScrollBottom:c,cachedMediaWidth:this.props.cachedMediaWidth,cacheMediaWidth:this.props.cacheMediaWidth,onUnmount:this.props.onUnmount,withDismiss:!0});default:return null}},e}(M.a);Object(s.a)(I,"propTypes",{notification:v.a.map.isRequired,hidden:h.a.bool,onMoveUp:h.a.func.isRequired,onMoveDown:h.a.func.isRequired,onMention:h.a.func.isRequired,getScrollPosition:h.a.func,updateScrollBottom:h.a.func,cacheMediaWidth:h.a.func,cachedMediaWidth:h.a.number,onUnmount:h.a.func});var x,S,U,D,F=n(19),W=Object(r.connect)(function(){var n=Object(u.e)();return function(t,e){return{notification:n(t,e.notification,e.accountId),notifCleaning:t.getIn(["notifications","cleaningMode"])}}},function(n){return{onMention:function(t,e){n(Object(F.gb)(t,e))}}})(I),T=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.render=function(){return Object(p.a)("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.props.onClick},void 0,Object(p.a)("i",{className:"fa fa-eraser"})," ",Object(p.a)(w.b,{id:"notifications.clear",defaultMessage:"Clear notifications"}))},e}(O.a.Component),q=n(925),A=function(o){function t(){for(var n,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n=o.call.apply(o,[this].concat(e))||this,Object(s.a)(Object(a.a)(n),"onPushChange",function(t,e){n.props.onChange(["push"].concat(t),e)}),n}return Object(i.a)(t,o),t.prototype.render=function(){var t=this.props,e=t.settings,n=t.pushSettings,i=t.onChange,o=t.onClear,a=Object(p.a)(w.b,{id:"notifications.column_settings.filter_bar.show",defaultMessage:"Show"}),s=Object(p.a)(w.b,{id:"notifications.column_settings.filter_bar.advanced",defaultMessage:"Display all categories"}),c=Object(p.a)(w.b,{id:"notifications.column_settings.alert",defaultMessage:"Desktop notifications"}),l=Object(p.a)(w.b,{id:"notifications.column_settings.show",defaultMessage:"Show in column"}),r=Object(p.a)(w.b,{id:"notifications.column_settings.sound",defaultMessage:"Play sound"}),d=n.get("browserSupport")&&n.get("isSubscribed"),f=d&&Object(p.a)(w.b,{id:"notifications.column_settings.push",defaultMessage:"Push notifications"}),u=d&&Object(p.a)(w.b,{id:"notifications.column_settings.push_meta",defaultMessage:"This device"});return Object(p.a)("div",{},void 0,Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(T,{onClick:o})),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-filter-bar"},void 0,Object(p.a)("span",{id:"notifications-filter-bar",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.filter_bar.category",defaultMessage:"Quick filter bar"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","show"],onChange:i,label:a}),Object(p.a)(q.a,{id:"show-filter-bar",prefix:"notifications",settings:e,settingPath:["quickFilter","advanced"],onChange:i,label:s}))),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-follow"},void 0,Object(p.a)("span",{id:"notifications-follow",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.follow",defaultMessage:"New followers:"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","follow"],onChange:i,label:c}),d&&Object(p.a)(q.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","follow"],meta:u,onChange:this.onPushChange,label:f}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["shows","follow"],onChange:i,label:l}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["sounds","follow"],onChange:i,label:r}))),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-favourite"},void 0,Object(p.a)("span",{id:"notifications-favourite",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.favourite",defaultMessage:"Favourites:"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","favourite"],onChange:i,label:c}),d&&Object(p.a)(q.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","favourite"],meta:u,onChange:this.onPushChange,label:f}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["shows","favourite"],onChange:i,label:l}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["sounds","favourite"],onChange:i,label:r}))),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-mention"},void 0,Object(p.a)("span",{id:"notifications-mention",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.mention",defaultMessage:"Mentions:"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","mention"],onChange:i,label:c}),d&&Object(p.a)(q.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","mention"],meta:u,onChange:this.onPushChange,label:f}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["shows","mention"],onChange:i,label:l}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["sounds","mention"],onChange:i,label:r}))),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-reblog"},void 0,Object(p.a)("span",{id:"notifications-reblog",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.reblog",defaultMessage:"Boosts:"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","reblog"],onChange:i,label:c}),d&&Object(p.a)(q.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","reblog"],meta:u,onChange:this.onPushChange,label:f}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["shows","reblog"],onChange:i,label:l}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["sounds","reblog"],onChange:i,label:r}))),Object(p.a)("div",{role:"group","aria-labelledby":"notifications-poll"},void 0,Object(p.a)("span",{id:"notifications-poll",className:"column-settings__section"},void 0,Object(p.a)(w.b,{id:"notifications.column_settings.poll",defaultMessage:"Poll results:"})),Object(p.a)("div",{className:"column-settings__row"},void 0,Object(p.a)(q.a,{prefix:"notifications_desktop",settings:e,settingPath:["alerts","poll"],onChange:i,label:c}),d&&Object(p.a)(q.a,{prefix:"notifications_push",settings:n,settingPath:["alerts","poll"],meta:u,onChange:this.onPushChange,label:f}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["shows","poll"],onChange:i,label:l}),Object(p.a)(q.a,{prefix:"notifications",settings:e,settingPath:["sounds","poll"],onChange:i,label:r}))))},t}(O.a.PureComponent),L=n(69),B=n(205),R=n(50),H=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"}}),z=Object(w.g)(Object(r.connect)(function(t){return{settings:t.getIn(["settings","notifications"]),pushSettings:t.get("push_notifications")}},function(n,t){var e=t.intl;return{onChange:function(t,e){"push"===t[0]?n(Object(B.e)(t.slice(1),e)):"quickFilter"===t[0]?(n(Object(L.c)(["notifications"].concat(t),e)),n(Object(d.z)("all"))):n(Object(L.c)(["notifications"].concat(t),e))},onClear:function(){n(Object(R.d)("CONFIRM",{message:e.formatMessage(H.clearMessage),confirm:e.formatMessage(H.clearConfirm),onConfirm:function(){return n(Object(d.q)())}}))}}})(A)),E=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"}}),G=Object(w.g)(x=function(t){function e(){return t.apply(this,arguments)||this}Object(i.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,i=t.intl;return n?Object(p.a)("div",{className:"notification__filter-bar"},void 0,Object(p.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(p.a)(w.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(p.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention"),title:i.formatMessage(E.mentions)},void 0,Object(p.a)("i",{className:"fa fa-fw fa-at"})),Object(p.a)("button",{className:"favourite"===e?"active":"",onClick:this.onClick("favourite"),title:i.formatMessage(E.favourites)},void 0,Object(p.a)("i",{className:"fa fa-fw fa-star"})),Object(p.a)("button",{className:"reblog"===e?"active":"",onClick:this.onClick("reblog"),title:i.formatMessage(E.boosts)},void 0,Object(p.a)("i",{className:"fa fa-fw fa-retweet"})),Object(p.a)("button",{className:"poll"===e?"active":"",onClick:this.onClick("poll"),title:i.formatMessage(E.polls)},void 0,Object(p.a)("i",{className:"fa fa-fw fa-tasks"})),Object(p.a)("button",{className:"follow"===e?"active":"",onClick:this.onClick("follow"),title:i.formatMessage(E.follows)},void 0,Object(p.a)("i",{className:"fa fa-fw fa-user-plus"}))):Object(p.a)("div",{className:"notification__filter-bar"},void 0,Object(p.a)("button",{className:"all"===e?"active":"",onClick:this.onClick("all")},void 0,Object(p.a)(w.b,{id:"notifications.filter.all",defaultMessage:"All"})),Object(p.a)("button",{className:"mention"===e?"active":"",onClick:this.onClick("mention")},void 0,Object(p.a)(w.b,{id:"notifications.filter.mentions",defaultMessage:"Mentions"})))},e}(O.a.PureComponent))||x,J=Object(r.connect)(function(t){return{selectedFilter:t.getIn(["settings","notifications","quickFilter","active"]),advancedMode:t.getIn(["settings","notifications","quickFilter","advanced"])}},function(e){return{selectFilter:function(t){e(Object(d.z)(t))}}})(G),K=n(61),V=n(4),Q=n(934),Y=n(968);n.d(e,"default",function(){return $});var X=Object(w.f)({title:{id:"column.notifications",defaultMessage:"Notifications"}}),Z=Object(K.a)([function(t){return t.getIn(["settings","notifications","quickFilter","show"])},function(t){return t.getIn(["settings","notifications","quickFilter","active"])},function(t){return Object(V.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"))})}),$=Object(r.connect)(function(t){return{showFilterBar:t.getIn(["settings","notifications","quickFilter","show"]),notifications:Z(t),localSettings:t.get("local_settings"),isLoading:t.getIn(["notifications","isLoading"],!0),isUnread:0<t.getIn(["notifications","unread"]),hasMore:t.getIn(["notifications","hasMore"]),notifCleaningActive:t.getIn(["notifications","cleaningMode"])}},function(e){return{onEnterCleaningMode:function(t){e(Object(d.s)(t))},onMount:function(){e(Object(d.w)())},onUnmount:function(){e(Object(d.A)())},dispatch:e}})(S=Object(w.g)((D=U=function(o){function t(){for(var i,t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return i=o.call.apply(o,[this].concat(e))||this,Object(s.a)(Object(a.a)(i),"handleLoadGap",function(t){i.props.dispatch(Object(d.t)({maxId:t}))}),Object(s.a)(Object(a.a)(i),"handleLoadOlder",c()(function(){var t=i.props.notifications.last();i.props.dispatch(Object(d.t)({maxId:t&&t.get("id")}))},300,{leading:!0})),Object(s.a)(Object(a.a)(i),"handleScrollToTop",c()(function(){i.props.dispatch(Object(d.y)(!0))},100)),Object(s.a)(Object(a.a)(i),"handleScroll",c()(function(){i.props.dispatch(Object(d.y)(!1))},100)),Object(s.a)(Object(a.a)(i),"handlePin",function(){var t=i.props,e=t.columnId,n=t.dispatch;n(e?Object(f.h)(e):Object(f.e)("NOTIFICATIONS",{}))}),Object(s.a)(Object(a.a)(i),"handleMove",function(t){var e=i.props,n=e.columnId;(0,e.dispatch)(Object(f.g)(n,t))}),Object(s.a)(Object(a.a)(i),"handleHeaderClick",function(){i.column.scrollTop()}),Object(s.a)(Object(a.a)(i),"setColumnRef",function(t){i.column=t}),Object(s.a)(Object(a.a)(i),"handleMoveUp",function(e){var t=i.props.notifications.findIndex(function(t){return null!==t&&t.get("id")===e})-1;i._selectChild(t,!0)}),Object(s.a)(Object(a.a)(i),"handleMoveDown",function(e){var t=i.props.notifications.findIndex(function(t){return null!==t&&t.get("id")===e})+1;i._selectChild(t,!1)}),i}Object(i.a)(t,o);var e=t.prototype;return e._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())},e.componentDidMount=function(){var t=this.props.onMount;t&&t()},e.componentWillUnmount=function(){var t=this.props.onUnmount;t&&t()},e.render=function(){var n=this,t=this.props,e=t.intl,i=t.notifications,o=t.shouldUpdateScroll,a=t.isLoading,s=t.isUnread,c=t.columnId,l=t.multiColumn,r=t.hasMore,d=t.showFilterBar,f=!!c,u=Object(p.a)(w.b,{id:"empty_column.notifications",defaultMessage:"You don't have any notifications yet. Interact with others to start the conversation."}),b=null,h=d?Object(p.a)(J,{}):null;b=a&&this.scrollableContent?this.scrollableContent:0<i.size||r?i.map(function(t,e){return null===t?Object(p.a)(Y.a,{disabled:a,maxId:0<e?i.getIn([e-1,"id"]):null,onClick:n.handleLoadGap},"gap:"+i.getIn([e+1,"id"])):Object(p.a)(W,{notification:t,accountId:t.get("account"),onMoveUp:n.handleMoveUp,onMoveDown:n.handleMoveDown},t.get("id"))}):null,this.scrollableContent=b;var g=Object(p.a)(Q.a,{scrollKey:"notifications-"+c,trackScroll:!f,isLoading:a,showLoading:a&&0===i.size,hasMore:r,emptyMessage:u,onLoadMore:this.handleLoadOlder,onScrollToTop:this.handleScrollToTop,onScroll:this.handleScroll,shouldUpdateScroll:o},void 0,b);return O.a.createElement(j.a,{ref:this.setColumnRef,name:"notifications",extraClasses:this.props.notifCleaningActive?"notif-cleaning":null,label:e.formatMessage(X.title)},Object(p.a)(m.a,{icon:"bell",active:s,title:e.formatMessage(X.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:f,multiColumn:l,localSettings:this.props.localSettings,notifCleaning:!0,notifCleaningActive:this.props.notifCleaningActive,onEnterCleaningMode:this.props.onEnterCleaningMode},void 0,Object(p.a)(z,{})),h,g)},t}(O.a.PureComponent),Object(s.a)(U,"defaultProps",{trackScroll:!0}),S=D))||S)||S}}]);
|
|
//# sourceMappingURL=notifications.js.map
|