pixelfed/public/js/direct.js

1 line
40 KiB
JavaScript
Raw Normal View History

2024-10-06 06:53:38 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[6205],{32836:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>n});var s=a(2e4),i=(a(87980),a(74692));const n={components:{Autocomplete:s.default},data:function(){return{config:window.App.config,loaded:!1,profile:{},page:"browse",pages:["browse","add","read"],tab:"inbox",tabs:["inbox","sent","filtered"],inboxPage:1,sentPage:1,filteredPage:1,threads:[],thread:!1,threadIndex:!1,replyText:"",composeUsername:"",ctxContext:null,ctxIndex:null,uploading:!1,uploadProgress:null,messages:{inbox:[],sent:[],filtered:[]},newType:"select",composeLoading:!1}},mounted:function(){var t=this;this.fetchProfile();var e=this;axios.get("/api/direct/browse",{params:{a:"inbox"}}).then((function(a){e.loaded=!0,t.threads=a.data,t.messages.inbox=a.data}))},updated:function(){i('[data-toggle="tooltip"]').tooltip()},methods:{fetchProfile:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,window._sharedData.curUser=e.data,window.App.util.navatar()}))},goto:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"browse";this.page=t},loadMessage:function(t){var e="/account/direct/t/"+t;window.location.href=e},truncate:function(t){return _.truncate(t)},switchTab:function(t){var e=this;switch(t){case"inbox":this.messages.inbox.length;break;case"sent":0==this.messages.sent.length&&axios.get("/api/direct/browse",{params:{a:"sent"}}).then((function(t){e.loaded=!0,e.threads=t.data,e.messages.sent=t.data}));break;case"filtered":0==this.messages.filtered.length&&axios.get("/api/direct/browse",{params:{a:"filtered"}}).then((function(t){e.loaded=!0,e.threads=t.data,e.messages.filtered=t.data}))}this.tab=t},composeSearch:function(t){if(t.length<1)return[];return axios.post("/api/direct/lookup",{q:t}).then((function(t){return t.data}))},getTagResultValue:function(t){return t.local?"@"+t.name:t.name},onTagSubmitLocation:function(t){this.composeLoading=!0,window.location.href="/account/direct/t/"+t.id},messagePagination:function(t,e){var a=this;"inbox"==t&&(this.inboxPage="prev"==e?this.inboxPage-1:this.inboxPage+1,axios.get("/api/direct/browse",{params:{a:"inbox",page:this.inboxPage}}).then((function(t){self.loaded=!0,a.threads=t.data,a.messages.inbox=t.data}))),"sent"==t&&(this.sentPage="prev"==e?this.sentPage-1:this.sentPage+1,axios.get("/api/direct/browse",{params:{a:"sent",page:this.sentPage}}).then((function(t){self.loaded=!0,a.threads=t.data,a.messages.sent=t.data}))),"filtered"==t&&(this.filteredPage="prev"==e?this.filteredPage-1:this.filteredPage+1,axios.get("/api/direct/browse",{params:{a:"filtered",page:this.filteredPage}}).then((function(t){self.loaded=!0,a.threads=t.data,a.messages.filtered=t.data})))}}}},27943:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>r});var s=a(74692);function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?n(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,s=Array(e);a<e;a++)s[a]=t[a];return s}const r={props:["accountId"],data:function(){return{config:window.App.config,hideAvatars:!0,hideTimestamps:!1,largerText:!1,autoRefresh:!1,mutedNotifications:!1,blocked:!1,loaded:!1,profile:{},page:"read",pages:["browse","add","read"],threads:[],thread:!1,threadIndex:!1,replyText:"",composeUsername:"",ctxContext:null,ctxIndex:null,uploading:!1,uploadProgress:null,min_id:null,max_id:null,loadingMessages:!1,showLoadMore:!0}},mounted:function(){var t=this;this.fetchProfile();var e=this;axios.get("/api/direct/thread",{pa