pixelfed/public/js/dms-123122-swxib.js

1 line
8.7 KiB
JavaScript
Raw Normal View History

2022-12-31 08:44:14 +00:00
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[25],{79932:(t,e,a)=>{a.r(e),a.d(e,{default:()=>o});var s=a(42755),i=a(88231),n=a(33795),r=a(78423);const o={components:{drawer:s.default,sidebar:i.default,intersect:r.default,"dm-placeholder":n.default},data:function(){return{isLoaded:!1,profile:void 0,canLoadMore:!0,threadsLoaded:!1,composeLoading:!1,threads:[],tabIndex:0,tabs:["inbox","sent","requests"],page:1,ids:[],isIntersecting:!1}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0,this.fetchThreads()},methods:{fetchThreads:function(){var t=this;axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex]}}).then((function(e){var a=e.data.filter((function(t){return t&&t.hasOwnProperty("last_status")&&t.last_status})),s=a.map((function(t){return t.accounts[0].id}));t.ids=s,t.threads=a,t.threadsLoaded=!0,t.page++}))},timeago:function(t){return App.util.format.timeAgo(t)},enterIntersect:function(){var t=this;this.isIntersecting||(this.isIntersecting=!0,axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex],page:this.page}}).then((function(e){if(e.data.filter((function(t){return t&&t.hasOwnProperty("last_status")&&t.last_status})).forEach((function(e){-1==t.ids.indexOf(e.accounts[0].id)&&(t.ids.push(e.accounts[0].id),t.threads.push(e))})),!e.data.length||e.data.length<5)return t.canLoadMore=!1,void(t.isIntersecting=!1);t.page++,t.isIntersecting=!1})))},toggleTab:function(t){event.currentTarget.blur(),this.threadsLoaded=!1,this.page=1,this.tabIndex=t,this.fetchThreads()},threadSummary:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if("photo"==t.pf_type){var a=this.profile.id==t.account.id,s='<div class="'+(a?"text-muted":"text-primary")+' border px-2 py-1 mt-1 rounded" style="font-size:11px;width: fit-content"><i class="far fa-image mr-1"></i> <span>';return(s+=a?"Sent a photo":"Received a photo")+"</span></div>"}if("video"==t.pf_type){var i=this.profile.id==t.account.id,n='<div class="'+(i?"text-muted":"text-primary")+' border px-2 py-1 mt-1 rounded" style="font-size:11px;width: fit-content"><i class="far fa-video mr-1"></i> <span>';return(n+=i?"Sent a video":"Received a video")+"</span></div>"}var r="";this.profile.id==t.account.id&&(r+='<i class="far fa-reply-all fa-flip-both"></i> ');var o=t.content,d=o.replace(/(<([^>]+)>)/gi,"");return d.length>e?r+d.slice(0,e)+"...":r+d},openCompose:function(){this.$refs.compose.show()},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="/i/web/direct/thread/"+t.id},closeCompose:function(){this.$refs.compose.hide()}}}},82690:(t,e,a)=>{a.r(e),a.d(e,{render:()=>s,staticRenderFns:()=>i});var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"dms-page-component"},[t.isLoaded?e("div",{staticClass:"container-fluid mt-3"},[e("div",{staticClass:"row"},[e("div",{staticClass:"col-md-3 d-md-block"},[e("sidebar",{attrs:{user:t.profile}})],1),t._v(" "),e("div",{staticClass:"col-md-5 offset-md-1 mb-5 order-2 order-md-1"},[e("h1",{staticClass:"font-weight-bold mb-4"},[t._v("Direct Messages")]),t._v(" "),t.threadsLoaded?e("div",[t._l(t.threads,(function(a,s){return e("div",{staticClass:"card shadow-sm mb-1",staticStyle:{"border-radius":"15px"}},[e("div",{staticClass:"card-body p-3"},[e("div",{staticClass:"media"},[e("img",{staticClass:"shadow-sm mr-3",staticStyle:{"border-radius":"15px"},attrs:{src:a.accounts[0].avatar,width:"45",height:"45",onerror:"this.onerror=null;this.src='/storage/avatars/default.png?v=0';"}}),t._v(" "),e("div",{staticClass:"media-body"},[e("div",{staticClass:"d-flex justify-content-between align-items-start mb-1"},[e("p",{staticClass:"dm-display-name font-weight-bold mb-0"},[t._v("@"+t._s(a.accounts[0].acct))]),t._v(" "),e("p",{staticClass:"font-weight-bold small text-muted mb-0"},[t._v(t._s(t.timeago(a.last_status.created_at))+" a