3 lines
No EOL
27 KiB
JavaScript
3 lines
No EOL
27 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/confirm_modal.f5dYyJF2.js","static/js/_plugin-vue_export-helper.By3-ojQa.js","static/js/chunk.aKtaBQYM.js","static/js/free-solid-svg-icons.vn_kySUQ.js","static/js/runtime-dom.esm-bundler.DzcUlaDE.js","static/js/dialog_modal.CxsP9W3P.js","static/js/oauth.C4JLKGAu.js","static/js/lodash.daI9UflD.js","static/js/modal.BLgTTi-o.js","static/css/modal.Dv3V-p-W.css","static/js/helpers.DO6M90bq.js","static/css/dialog_modal.DC5hTqSH.css","static/css/confirm_modal.CxXYsWAn.css"])))=>i.map(i=>d[i]);
|
|
import{n as e}from"./chunk.aKtaBQYM.js";import{B as t,I as n,M as r,R as i,U as a,X as o,Y as s,_ as c,d as l,f as u,g as d,i as f,l as p,o as m,p as h,q as g,t as _,u as v,v as y}from"./_plugin-vue_export-helper.By3-ojQa.js";import{s as b}from"./runtime-dom.esm-bundler.DzcUlaDE.js";import{a as x}from"./modal.BLgTTi-o.js";import{i as S,r as C}from"./vuex.esm-bundler.CWMfctgB.js";import{A as w,An as T,F as E,Fn as D,In as O,O as k,On as A,Pn as j,c as M,d as N,jn as P,kn as ee,n as F,q as te}from"./oauth.C4JLKGAu.js";import{L as ne,O as re,Pt as ie,Sn as I,X as ae,Xt as oe,_ as se,_n as ce,et as L,kn as R,ln as z,o as B,pn as V,st as H,x as U,xn as W,z as G}from"./free-solid-svg-icons.vn_kySUQ.js";import{t as le}from"./preload-helper.zJ_50EbN.js";import{a as ue,i as de}from"./user_card.DVbLIASH.js";import{t as fe}from"./popover.94nM-RDc.js";import{t as pe}from"./select.BU31Em0g.js";import{t as K}from"./user_profile_link_generator.WrdnW5sg.js";import{t as me}from"./user_link.CzPI9p_B.js";import{F as he,I as ge,P as _e,W as q,b as J,o as ve,y as Y,z as X}from"./main.CPF6dYCY.js";R.add(I,ne,se);var ye={computed:{shouldShowChats(){return this.mergedConfig.showExtraNotifications&&this.mergedConfig.showChatsInExtraNotifications&&this.unreadChatCount},shouldShowAnnouncements(){return this.mergedConfig.showExtraNotifications&&this.mergedConfig.showAnnouncementsInExtraNotifications&&this.unreadAnnouncementCount},shouldShowFollowRequests(){return this.mergedConfig.showExtraNotifications&&this.mergedConfig.showFollowRequestsInExtraNotifications&&this.followRequestCount},hasAnythingToShow(){return this.shouldShowChats||this.shouldShowAnnouncements||this.shouldShowFollowRequests},shouldShowCustomizationTip(){return this.mergedConfig.showExtraNotificationsTip&&this.hasAnythingToShow},currentUser(){return this.$store.state.users.currentUser},...C([`unreadChatCount`,`followRequestCount`]),...x(q,{unreadAnnouncementCount:`unreadAnnouncementCount`}),...x(k,[`mergedConfig`])},methods:{openNotificationSettings(){return N().openSettingsModalTab(`notifications`)},dismissConfigurationTip(){return w().setSimplePrefAndSave({path:`showExtraNotificationsTip`,value:!1})}}},be={class:`ExtraNotifications panel-body`},xe={key:0,class:`notification unseen`},Se={key:1,class:`notification unseen`},Ce={key:2,class:`notification unseen`};function we(e,t,n,s,f,p){let m=i(`FAIcon`),g=i(`router-link`),_=i(`i18n-t`);return r(),h(`div`,be,[e.shouldShowChats?(r(),h(`div`,xe,[t[2]||=v(`div`,{class:`notification-overlay`},null,-1),c(g,{class:`button-unstyled -link extra-notification`,to:{name:`chats`,params:{username:e.currentUser.screen_name}}},{default:a(()=>[c(m,{"fixed-width":``,class:`fa-scale-110 icon`,icon:`comments`}),d(` `+o(e.$t(`notifications.unread_chats`,{num:e.unreadChatCount},e.unreadChatCount)),1)]),_:1},8,[`to`])])):u(``,!0),e.shouldShowAnnouncements?(r(),h(`div`,Se,[t[3]||=v(`div`,{class:`notification-overlay`},null,-1),c(g,{class:`button-unstyled -link extra-notification`,to:{name:`announcements`}},{default:a(()=>[c(m,{"fixed-width":``,class:`fa-scale-110 icon`,icon:`bullhorn`}),d(` `+o(e.$t(`notifications.unread_announcements`,{num:e.unreadAnnouncementCount},e.unreadAnnouncementCount)),1)]),_:1})])):u(``,!0),e.shouldShowFollowRequests?(r(),h(`div`,Ce,[t[4]||=v(`div`,{class:`notification-overlay`},null,-1),c(g,{class:`button-unstyled -link extra-notification`,to:{name:`friend-requests`}},{default:a(()=>[c(m,{"fixed-width":``,class:`fa-scale-110 icon`,icon:`user-plus`}),d(` `+o(e.$t(`notifications.unread_follow_requests`,{num:e.followRequestCount},e.followRequestCount)),1)]),_:1})])):u(``,!0),e.shouldShowCustomizationTip?(r(),l(_,{key:3,tag:`span`,class:`notification tip extra-notification`,keypath:`notifications.configuration_tip`,scope:`global`},{theSettings:a(()=>[v(`button`,{class:`button-unstyled -link`,onClick:t[0]||=(...t)=>e.openNotificationSettings&&e.openNotificationSettings(...t)},o(e.$t(`notifications.configuration_tip_settings`)),1)]),dismiss:a(()=>[v(`button`,{class:`button-unstyled -link`,onClick:t[1]||=(...t)=>e.dismissConfigurationTip&&e.dismissConfigurationTip(...t)},o(e.$t(`notifications.configuration_tip_dismiss`)),1)]),_:1})):u(``,!0)])}var Te=_(ye,[[`render`,we]]),Ee={props:[`reportId`],components:{Select:pe,StatusContent:Y,Timeago:J},computed:{report(){return X().reports[this.reportId]||{}},state:{get:function(){return this.report.state},set:function(e){this.setReportState(e)}}},methods:{generateUserProfileLink(e){return K(e.id,e.screen_name,M().restrictedNicknames)},setReportState(e){return X().setReportState({id:this.report.id,state:e})}}},De={class:`Report`},Oe={class:`reported-user`},ke={class:`reporter`},Ae={class:`report-state`},je=[`value`],Me={key:0},Ne={class:`reported-status-heading`},Pe={class:`reported-status-name`},Fe={key:1};function Ie(e,t,s,p,m,g){let _=i(`router-link`),y=i(`Select`),b=i(`RichContent`),x=i(`Timeago`),S=i(`status-content`);return r(),h(`div`,De,[v(`div`,Oe,[v(`span`,null,o(e.$t(`report.reported_user`)),1),c(_,{to:e.generateUserProfileLink(e.report.acct)},{default:a(()=>[d(` @`+o(e.report.acct.screen_name),1)]),_:1},8,[`to`])]),v(`div`,ke,[v(`span`,null,o(e.$t(`report.reporter`)),1),c(_,{to:e.generateUserProfileLink(e.report.actor)},{default:a(()=>[d(` @`+o(e.report.actor.screen_name),1)]),_:1},8,[`to`])]),v(`div`,Ae,[v(`span`,null,o(e.$t(`report.state`)),1),c(y,{id:e.report-e.state,modelValue:e.state,"onUpdate:modelValue":t[0]||=t=>e.state=t,class:`input form-control`},{default:a(()=>[(r(),h(f,null,n([`open`,`closed`,`resolved`],t=>v(`option`,{key:t,value:t},o(e.$t(`report.state_`+t)),9,je)),64))]),_:1},8,[`id`,`modelValue`])]),c(b,{class:`report-content`,html:e.report.content,emoji:[]},null,8,[`html`]),e.report.statuses.length?(r(),h(`div`,Me,[v(`small`,null,o(e.$t(`report.reported_statuses`)),1),(r(!0),h(f,null,n(e.report.statuses,e=>(r(),l(_,{key:e.id,to:{name:`conversation`,params:{id:e.id}},class:`reported-status`},{default:a(()=>[v(`div`,Ne,[v(`span`,Pe,o(e.user.name),1),c(x,{time:e.created_at,"auto-update":240,class:`faint`},null,8,[`time`])]),c(S,{status:e},null,8,[`status`])]),_:2},1032,[`to`]))),128))])):u(``,!0),e.report.notes.length?(r(),h(`div`,Fe,[v(`small`,null,o(e.$t(`report.notes`)),1),(r(!0),h(f,null,n(e.report.notes,e=>(r(),h(`div`,{key:e.id,class:`note`},[v(`span`,null,o(e.content),1),c(x,{time:e.created_at,"auto-update":240,class:`faint`},null,8,[`time`])]))),128))])):u(``,!0)])}var Le=_(Ee,[[`render`,Ie]]);R.add(U,ce,z,oe,I,W,L,V,ae,G);var Re={data(){return{selecting:!1,statusExpanded:!1,unmuted:!1,showingApproveConfirmDialog:!1,showingDenyConfirmDialog:!1}},props:[`notification`],emits:[`interacted`],components:{StatusContent:Y,UserAvatar:de,Timeago:J,Report:Le,UserPopover:ge,UserLink:me,ConfirmModal:y(()=>le(()=>import(`./confirm_modal.f5dYyJF2.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])))},mounted(){document.addEventListener(`selectionchange`,this.onContentSelect)},unmounted(){document.removeEventListener(`selectionchange`,this.onContentSelect)},methods:{toggleStatusExpanded(){this.expandable&&(this.statusExpanded=!this.statusExpanded)},onContentSelect(){let{isCollapsed:e,anchorNode:t,offsetNode:n}=document.getSelection();if(e){this.selecting=!1;return}this.$refs.root.contains(t)||this.$refs.root.contains(n)?this.selecting=!0:this.selecting=!1},onContentClick(e){!this.selecting&&!e.target.closest(`a`)&&!e.target.closest(`button`)&&this.toggleStatusExpanded()},generateUserProfileLink(e){return K(e.id,e.screen_name,M().restrictedNicknames)},getUser(e){return this.$store.state.users.usersObject[e.from_profile.id]},interacted(){this.$emit(`interacted`)},toggleMute(){this.unmuted=!this.unmuted},showApproveConfirmDialog(){this.showingApproveConfirmDialog=!0},hideApproveConfirmDialog(){this.showingApproveConfirmDialog=!1},showDenyConfirmDialog(){this.showingDenyConfirmDialog=!0},hideDenyConfirmDialog(){this.showingDenyConfirmDialog=!1},approveUser(){this.shouldConfirmApprove?this.showApproveConfirmDialog():this.doApprove()},doApprove(){E({id:this.user.id,credentials:F().token}),this.$store.dispatch(`removeFollowRequest`,this.user),this.$store.dispatch(`markSingleNotificationAsSeen`,{id:this.notification.id}),this.$store.dispatch(`updateNotification`,{id:this.notification.id,updater:e=>{e.type=`follow`}}),this.hideApproveConfirmDialog()},denyUser(){this.shouldConfirmDeny?this.showDenyConfirmDialog():this.doDeny()},doDeny(){te({id:this.user.id,credentials:F().token}).then(()=>{this.$store.dispatch(`dismissNotificationLocal`,{id:this.notification.id}),this.$store.dispatch(`removeFollowRequest`,this.user)}),this.hideDenyConfirmDialog()}},computed:{userClass(){return _e(this.notification.from_profile)},userStyle(){let e=this.notification.from_profile.screen_name;return he(ue().get(e))},expandable(){return new Set([`like`,`pleroma:emoji_reaction`,`repeat`,`poll`]).has(this.notification.type)},user(){return this.$store.getters.findUser(this.notification.from_profile.id)},userProfileLink(){return this.generateUserProfileLink(this.user)},targetUser(){return this.$store.getters.findUser(this.notification.target.id)},targetUserProfileLink(){return this.generateUserProfileLink(this.targetUser)},needMute(){return this.$store.getters.relationship(this.user.id).muting},isStatusNotification(){return P(this.notification.type)},mergedConfig(){return k().mergedConfig},allowNonSquareEmoji(){return this.mergedConfig.nonSquareEmoji},pauseMfm(){return this.mergedConfig.pauseMfm},scaleMfm(){return this.mergedConfig.scaleMfm},shouldConfirmApprove(){return this.mergedConfig.modalOnApproveFollow},shouldConfirmDeny(){return this.mergedConfig.modalOnDenyFollow},...S({currentUser:e=>e.users.currentUser})}},ze={key:0,ref:`root`},Be=[`id`,`aria-expanded`,`aria-controls`],Ve=[`href`],He={class:`notification-right`},Ue={class:`notification-details`},We={class:`name-and-action`},Ge={key:0},Ke=[`title`],qe={key:2},Je={key:3},Ye={key:4},Xe={key:5},Ze={key:6},Qe={key:7},$e=[`src`,`alt`,`title`],et={key:1,class:`emoji-reaction-emoji`},tt={key:8},nt={key:9},rt={key:0,class:`timeago`},it=[`title`,`aria-expanded`],at={key:1,class:`timeago`},ot={class:`faint`},st=[`title`,`aria-expanded`],ct={key:0,class:`follow-text`},lt={key:0,style:{"white-space":`nowrap`}},ut=[`title`],dt=[`title`],ft={key:1,class:`move-text`};function pt(e,t,n,f,p,_){let y=i(`Status`),x=i(`user-link`),S=i(`FAIcon`),C=i(`UserAvatar`),w=i(`UserPopover`),T=i(`RichContent`),E=i(`i18n-t`),D=i(`Timeago`),O=i(`router-link`),k=i(`Report`),A=i(`StatusContent`),j=i(`ConfirmModal`);return e.notification.type===`mention`||e.notification.type===`status`?(r(),h(`article`,ze,[c(y,{class:`Notification panel-body`,compact:!0,statusoid:e.notification.status,onClick:e.interacted},null,8,[`statusoid`,`onClick`])],512)):(r(),h(`article`,{key:1,ref:`root`,class:g([`NotificationParent panel-body`,{"-expandable":e.expandable}])},[e.needMute&&!e.unmuted?(r(),h(`div`,{key:0,id:`notif-`+e.notification.id,"aria-expanded":e.statusExpanded,"aria-controls":`notif-`+e.notification.id,class:`Notification container -muted`},[v(`small`,null,[c(x,{user:e.notification.from_profile,at:!1},null,8,[`user`])]),v(`button`,{class:`button-unstyled unmute`,onClick:t[0]||=b((...t)=>e.toggleMute&&e.toggleMute(...t),[`prevent`])},[c(S,{class:`fa-scale-110 fa-old-padding`,icon:`eye-slash`})])],8,Be)):(r(),h(`div`,{key:1,class:g([`Notification non-mention`,[e.userClass,{highlighted:e.userStyle},`-type--`+e.notification.type]]),style:s([e.userStyle])},[v(`a`,{class:`avatar-container`,href:e.$router.resolve(e.userProfileLink).href,onClick:t[1]||=b(()=>{},[`prevent`])},[c(w,{"user-id":e.notification.from_profile.id,"overlay-centers":!0},{default:a(()=>[c(C,{class:`post-avatar`,compact:!0,user:e.notification.from_profile},null,8,[`user`])]),_:1},8,[`user-id`])],8,Ve),v(`div`,He,[v(`span`,Ue,[v(`div`,We,[e.notification.from_profile.name_html?(r(),h(`bdi`,Ge,[c(T,{class:`username`,title:`@`+e.notification.from_profile.screen_name_ui,html:e.notification.from_profile.name_html,emoji:e.notification.from_profile.emoji,"allow-non-square-emoji":e.allowNonSquareEmoji,"pause-mfm":e.pauseMfm,"scale-mfm":e.scaleMfm,"is-local":e.notification.from_profile.is_local},null,8,[`title`,`html`,`emoji`,`allow-non-square-emoji`,`pause-mfm`,`scale-mfm`,`is-local`])])):(r(),h(`span`,{key:1,class:`username`,title:`@`+e.notification.from_profile.screen_name_ui},o(e.notification.from_profile.name),9,Ke)),t[12]||=d(` `+o(` `)+` `,-1),e.notification.type===`like`?(r(),h(`span`,qe,[c(S,{class:`type-icon`,icon:`star`}),t[6]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.favorited_you`)),1)])):u(``,!0),e.notification.type===`repeat`?(r(),h(`span`,Je,[c(S,{class:`type-icon`,icon:`retweet`,title:e.$t(`tool_tip.repeat`)},null,8,[`title`]),t[7]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.repeated_you`)),1)])):u(``,!0),e.notification.type===`follow`?(r(),h(`span`,Ye,[c(S,{class:`type-icon`,icon:`user-plus`}),t[8]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.followed_you`)),1)])):u(``,!0),e.notification.type===`follow_request`?(r(),h(`span`,Xe,[c(S,{class:`type-icon`,icon:`user`}),t[9]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.follow_request`)),1)])):u(``,!0),e.notification.type===`move`?(r(),h(`span`,Ze,[c(S,{class:`type-icon`,icon:`suitcase-rolling`}),t[10]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.migrated_to`)),1)])):u(``,!0),e.notification.type===`pleroma:emoji_reaction`?(r(),h(`span`,Qe,[v(`small`,null,[c(E,{scope:`global`,keypath:`notifications.reacted_with`},{default:a(()=>[e.notification.emoji_url?(r(),h(`img`,{key:0,class:g([`emoji-reaction-emoji emoji-reaction-emoji-image`,{"-wide":e.allowNonSquareEmoji}]),src:e.notification.emoji_url,alt:e.notification.emoji,title:e.notification.emoji},null,10,$e)):(r(),h(`span`,et,o(e.notification.emoji),1))]),_:1})])])):u(``,!0),e.notification.type===`pleroma:report`?(r(),h(`span`,tt,[v(`small`,null,o(e.$t(`notifications.submitted_report`)),1)])):u(``,!0),e.notification.type===`poll`?(r(),h(`span`,nt,[c(S,{class:`type-icon`,icon:`poll-h`}),t[11]||=d(` `+o(` `)+` `,-1),v(`small`,null,o(e.$t(`notifications.poll_ended`)),1)])):u(``,!0)]),e.isStatusNotification?(r(),h(`div`,rt,[e.notification.status?(r(),l(O,{key:0,to:{name:`conversation`,params:{id:e.notification.status.id}},class:`timeago-link faint`},{default:a(()=>[c(D,{time:e.notification.created_at,"auto-update":240},null,8,[`time`])]),_:1},8,[`to`])):u(``,!0),v(`button`,{class:`button-unstyled expand-icon`,title:e.$t(`tool_tip.toggle_expand`),"aria-expanded":e.statusExpanded,onClick:t[2]||=b((...t)=>e.toggleStatusExpanded&&e.toggleStatusExpanded(...t),[`prevent`])},[c(S,{class:`fa-scale-110`,"fixed-width":``,icon:e.statusExpanded?`compress-alt`:`expand-alt`},null,8,[`icon`])],8,it)])):(r(),h(`div`,at,[v(`span`,ot,[c(D,{time:e.notification.created_at,"auto-update":240},null,8,[`time`])])])),e.needMute?(r(),h(`button`,{key:2,class:`button-unstyled`,title:e.$t(`tool_tip.toggle_mute`),"aria-expanded":!e.unmuted,onClick:t[3]||=b((...t)=>e.toggleMute&&e.toggleMute(...t),[`prevent`])},[c(S,{class:`fa-scale-110 fa-old-padding`,icon:`eye-slash`})],8,st)):u(``,!0)]),e.notification.type===`follow`||e.notification.type===`follow_request`?(r(),h(`div`,ct,[c(x,{class:`follow-name`,user:e.notification.from_profile},null,8,[`user`]),e.notification.type===`follow_request`?(r(),h(`div`,lt,[v(`button`,{class:`button-unstyled`,title:e.$t(`tool_tip.accept_follow_request`),onClick:t[4]||=t=>e.approveUser()},[c(S,{icon:`check`,class:`fa-scale-110 fa-old-padding follow-request-accept`})],8,ut),v(`button`,{class:`button-unstyled`,title:e.$t(`tool_tip.reject_follow_request`),onClick:t[5]||=t=>e.denyUser()},[c(S,{icon:`times`,class:`fa-scale-110 fa-old-padding follow-request-reject`})],8,dt)])):u(``,!0)])):e.notification.type===`move`?(r(),h(`div`,ft,[c(x,{user:e.notification.target},null,8,[`user`])])):e.notification.type===`pleroma:report`?(r(),l(k,{key:2,"report-id":e.notification.report.id},null,8,[`report-id`])):(r(),l(A,{key:3,class:`status-content`,compact:!e.statusExpanded,status:e.notification.status,collapse:!e.statusExpanded,onClick:e.onContentClick},null,8,[`compact`,`status`,`collapse`,`onClick`]))])],6)),(r(),l(m,{to:`#modal`},[e.showingApproveConfirmDialog?(r(),l(j,{key:0,title:e.$t(`user_card.approve_confirm_title`),"confirm-text":e.$t(`user_card.approve_confirm_accept_button`),"cancel-text":e.$t(`user_card.approve_confirm_cancel_button`),onAccepted:e.doApprove,onCancelled:e.hideApproveConfirmDialog},{default:a(()=>[d(o(e.$t(`user_card.approve_confirm`,{user:e.user.screen_name_ui})),1)]),_:1},8,[`title`,`confirm-text`,`cancel-text`,`onAccepted`,`onCancelled`])):u(``,!0),e.showingDenyConfirmDialog?(r(),l(j,{key:1,title:e.$t(`user_card.deny_confirm_title`),"confirm-text":e.$t(`user_card.deny_confirm_accept_button`),"cancel-text":e.$t(`user_card.deny_confirm_cancel_button`),onAccepted:e.doDeny,onCancelled:e.hideDenyConfirmDialog},{default:a(()=>[d(o(e.$t(`user_card.deny_confirm`,{user:e.user.screen_name_ui})),1)]),_:1},8,[`title`,`confirm-text`,`cancel-text`,`onAccepted`,`onCancelled`])):u(``,!0)]))],2))}var mt=_(Re,[[`render`,pt]]);R.add(H);var ht={components:{Popover:fe},computed:{filters(){return k().mergedConfig.notificationVisibility}},methods:{toggleNotificationFilter(e){w().setSimplePrefAndSave({path:`notificationVisibility`,value:{...this.filters,[e]:!this.filters[e]}})}}},gt={class:`dropdown-menu`},_t={class:`menu-item dropdown-item -icon`},vt={class:`menu-item dropdown-item -icon`},yt={class:`menu-item dropdown-item -icon`},bt={class:`menu-item dropdown-item -icon`},xt={class:`menu-item dropdown-item -icon`},St={class:`menu-item dropdown-item -icon`},Ct={class:`menu-item dropdown-item -icon`},wt={class:`menu-item dropdown-item -icon`},Tt={class:`filter-trigger-button button-unstyled`};function Et(e,t,n,s,u,f){let p=i(`FAIcon`),m=i(`Popover`);return r(),l(m,{trigger:`click`,class:`NotificationFilters`,placement:`bottom`,"bound-to":{x:`container`}},{content:a(()=>[v(`div`,gt,[v(`div`,_t,[v(`button`,{class:`main-button`,onClick:t[0]||=e=>f.toggleNotificationFilter(`likes`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.likes}])},null,2),d(o(e.$t(`settings.notification_visibility_likes`)),1)])]),v(`div`,vt,[v(`button`,{class:`main-button`,onClick:t[1]||=e=>f.toggleNotificationFilter(`repeats`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.repeats}])},null,2),d(o(e.$t(`settings.notification_visibility_repeats`)),1)])]),v(`div`,yt,[v(`button`,{class:`main-button`,onClick:t[2]||=e=>f.toggleNotificationFilter(`follows`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.follows}])},null,2),d(o(e.$t(`settings.notification_visibility_follows`)),1)])]),v(`div`,bt,[v(`button`,{class:`main-button`,onClick:t[3]||=e=>f.toggleNotificationFilter(`mentions`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.mentions}])},null,2),d(o(e.$t(`settings.notification_visibility_mentions`)),1)])]),v(`div`,xt,[v(`button`,{class:`main-button`,onClick:t[4]||=e=>f.toggleNotificationFilter(`statuses`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.statuses}])},null,2),d(o(e.$t(`settings.notification_visibility_statuses`)),1)])]),v(`div`,St,[v(`button`,{class:`main-button`,onClick:t[5]||=e=>f.toggleNotificationFilter(`emojiReactions`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.emojiReactions}])},null,2),d(o(e.$t(`settings.notification_visibility_emoji_reactions`)),1)])]),v(`div`,Ct,[v(`button`,{class:`main-button`,onClick:t[6]||=e=>f.toggleNotificationFilter(`moves`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.moves}])},null,2),d(o(e.$t(`settings.notification_visibility_moves`)),1)])]),v(`div`,wt,[v(`button`,{class:`main-button`,onClick:t[7]||=e=>f.toggleNotificationFilter(`polls`)},[v(`span`,{class:g([`input menu-checkbox`,{"menu-checkbox-checked":f.filters.polls}])},null,2),d(o(e.$t(`settings.notification_visibility_polls`)),1)])])])]),trigger:a(()=>[v(`button`,Tt,[c(p,{icon:`filter`})])]),_:1})}var Dt=_(ht,[[`render`,Et]]);R.add(re,B,ie);var Z=30,Q={components:{Notification:mt,NotificationFilters:Dt,ExtraNotifications:Te},props:{minimalMode:Boolean,filterMode:Array,noExtra:{type:Boolean,default:!1},disableTeleport:Boolean},data(){return{showScrollTop:!1,bottomedOut:!1,seenToDisplayCount:Z}},provide(){return{popoversZLayer:p(()=>this.popoversZLayer)}},computed:{mainClass(){return this.minimalMode?``:`panel panel-default`},notifications(){return j(this.$store)},error(){return this.$store.state.notifications.error},unseenNotifications(){return D(this.$store,k().mergedConfig.notificationVisibility,k().mergedConfig.ignoreInactionableSeen)},filteredNotifications(){return this.unseenAtTop?[...T(this.$store,k().mergedConfig.notificationVisibility).filter(e=>this.shouldShowUnseen(e)),...T(this.$store,k().mergedConfig.notificationVisibility).filter(e=>!this.shouldShowUnseen(e))]:T(this.$store,k().mergedConfig.notificationVisibility,this.filterMode)},unseenCountBadgeText(){return`${this.unseenCount?this.unseenCount:``}${this.extraNotificationsCount?`*`:``}`},unseenCount(){return this.unseenNotifications.length},ignoreInactionableSeen(){return k().mergedConfig.ignoreInactionableSeen},extraNotificationsCount(){return ee(this.$store,k().mergedConfig,q().unreadAnnouncementCount)},unseenCountTitle(){return this.unseenNotifications.length+this.unreadChatCount+this.unreadAnnouncementCount},loading(){return this.$store.state.notifications.loading},noHeading(){let{layoutType:e}=N();return this.minimalMode||e===`mobile`},teleportTarget(){return{wide:`#notifs-column`,mobile:`#mobile-notifications`}[this.layoutType]||`#notifs-sidebar`},popoversZLayer(){let{layoutType:e}=N();return e===`mobile`?`navbar`:null},notificationsToDisplay(){return this.filteredNotifications.slice(0,this.unseenCount+this.seenToDisplayCount)},noSticky(){return k().mergedConfig.disableStickyHeaders},unseenAtTop(){return k().mergedConfig.unseenAtTop},showExtraNotifications(){return!this.noExtra},...x(q,[`unreadAnnouncementCount`]),...C([`unreadChatCount`]),...x(N,[`layoutType`])},mounted(){this.scrollerRef=this.$refs.root.closest(`.column.-scrollable`),this.scrollerRef||=this.$refs.root.closest(`.mobile-notifications`),this.scrollerRef||=this.$refs.root.closest(`.column.main`),this.scrollerRef.addEventListener(`scroll`,this.updateScrollPosition)},unmounted(){this.scrollerRef&&this.scrollerRef.removeEventListener(`scroll`,this.updateScrollPosition)},watch:{unseenCountTitle(e){e>0?(O.drawFaviconBadge(),N().setPageTitle(`(${e})`)):(O.clearFaviconBadge(),N().setPageTitle(``))},teleportTarget(){this.$nextTick(()=>{this.scrollerRef.removeEventListener(`scroll`,this.updateScrollPosition),this.scrollerRef=this.$refs.root.closest(`.column.-scrollable`),this.scrollerRef||=this.$refs.root.closest(`.mobile-notifications`),this.scrollerRef.addEventListener(`scroll`,this.updateScrollPosition),this.updateScrollPosition()})}},methods:{scrollToTop(){this.scrollerRef.scrollTo({top:this.$refs.root.offsetTop})},updateScrollPosition(){this.showScrollTop=this.$refs.root.offsetTop<this.scrollerRef.scrollTop},shouldShowUnseen(e){if(e.seen)return!1;let t=A.has(e.type);return this.ignoreInactionableSeen?t:!0},notificationClicked(e){let{id:t}=e;this.$store.dispatch(`notificationClicked`,{id:t})},notificationInteracted(e){let{id:t}=e;this.$store.dispatch(`markSingleNotificationAsSeen`,{id:t})},markAsSeen(){this.$store.dispatch(`markNotificationsAsSeen`),this.seenToDisplayCount=Z},fetchOlderNotifications(){if(this.loading)return;let e=this.filteredNotifications.length-this.unseenCount;if(this.seenToDisplayCount<e){this.seenToDisplayCount=Math.min(this.seenToDisplayCount+20,e);return}else this.seenToDisplayCount>e&&(this.seenToDisplayCount=e);let t=this.$store,n=t.state.users.currentUser.credentials;t.commit(`setNotificationsLoading`,{value:!0}),ve.fetchAndUpdate({store:t,credentials:n,older:!0}).then(e=>{t.commit(`setNotificationsLoading`,{value:!1}),e.length===0&&(this.bottomedOut=!0),this.seenToDisplayCount+=e.length})}}},Ot=e({default:()=>$}),kt={key:0,class:`notifications-heading panel-heading -sticky`},At={class:`title`},jt={key:0,class:`badge -notification unseen-count`},Mt={key:0,class:`rightside-button`},Nt=[`title`],Pt={role:`feed`},Ft={key:0,role:`listitem`,class:`notification`},It=[`onClick`],Lt={class:`panel-footer`},Rt={key:0,class:`new-status-notification text-center faint`},zt={class:`new-status-notification text-center`},Bt={key:2,class:`new-status-notification text-center`};function Vt(e,s,p,_,y,x){let S=i(`FAIcon`),C=i(`FALayers`),w=i(`NotificationFilters`),T=i(`extra-notifications`),E=i(`notification`);return r(),l(m,{disabled:e.minimalMode||e.disableTeleport,to:e.teleportTarget},[(r(),l(t(e.noHeading?`div`:`aside`),{ref:`root`,class:g([{minimal:e.minimalMode},`Notifications`])},{default:a(()=>[v(`div`,{class:g(e.mainClass)},[e.noHeading?u(``,!0):(r(),h(`div`,kt,[v(`h1`,At,[d(o(e.$t(`notifications.notifications`))+` `,1),e.unseenCountBadgeText?(r(),h(`span`,jt,o(e.unseenCountBadgeText),1)):u(``,!0)]),e.showScrollTop?(r(),h(`div`,Mt,[v(`button`,{class:`button-unstyled scroll-to-top-button`,type:`button`,title:e.$t(`general.scroll_to_top`),onClick:s[0]||=(...t)=>e.scrollToTop&&e.scrollToTop(...t)},[c(C,{class:`fa-scale-110 fa-old-padding-layer`},{default:a(()=>[c(S,{icon:`arrow-up`}),c(S,{icon:`minus`,transform:`up-7`})]),_:1})],8,Nt)])):u(``,!0),e.unseenCount?(r(),h(`button`,{key:1,class:`button-default read-button`,type:`button`,onClick:s[1]||=b((...t)=>e.markAsSeen&&e.markAsSeen(...t),[`prevent`])},o(e.$t(`notifications.read`)),1)):u(``,!0),c(w,{class:`rightside-button`})])),v(`div`,Pt,[e.showExtraNotifications?(r(),h(`div`,Ft,[c(T)])):u(``,!0),(r(!0),h(f,null,n(e.notificationsToDisplay,t=>(r(),h(`div`,{key:t.id,role:`listitem`,class:g([`notification`,{unseen:!e.minimalMode&&e.shouldShowUnseen(t)}]),onClick:n=>e.notificationClicked(t)},[s[3]||=v(`div`,{class:`notification-overlay`},null,-1),c(E,{notification:t,onInteracted:n=>e.notificationInteracted(t)},null,8,[`notification`,`onInteracted`])],10,It))),128))]),v(`div`,Lt,[e.bottomedOut?(r(),h(`div`,Rt,o(e.$t(`notifications.no_more_notifications`)),1)):e.loading?(r(),h(`div`,Bt,[c(S,{icon:`circle-notch`,spin:``,size:`lg`})])):(r(),h(`button`,{key:1,class:`button-unstyled -link text-center`,onClick:s[2]||=b(t=>e.fetchOlderNotifications(),[`prevent`])},[v(`div`,zt,o(e.minimalMode?e.$t(`interactions.load_older`):e.$t(`notifications.load_older`)),1)]))])],2)]),_:1},8,[`class`]))],8,[`disabled`,`to`])}var $=_(Q,[[`render`,Vt]]);export{Ot as n,$ as t};
|
|
//# sourceMappingURL=notifications.WzZPeGzx.js.map
|