mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-18 11:03:17 +00:00
1 line
132 KiB
JavaScript
1 line
132 KiB
JavaScript
|
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[8774],{44928:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>a});var o=s(95002);const a={props:{gid:{type:String},name:{type:String}},components:{GroupStatus:o.default},data:function(){return{isLoaded:!1,group:!1,profile:!1,feed:[],page:1,ids:[]}},mounted:function(){this.fetchProfile()},methods:{fetchProfile:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.fetchGroup()}))},fetchGroup:function(){var t=this;axios.get("/api/v0/groups/"+this.gid).then((function(e){t.group=e.data,t.fetchFeed()}))},fetchFeed:function(){var t=this;axios.get("/api/v0/groups/topics/tag",{params:{gid:this.gid,name:this.name}}).then((function(e){t.feed=e.data,t.isLoaded=!0;var s=t;e.data.forEach((function(t){-1==s.ids.indexOf(t.id)&&s.ids.push(t.id)})),t.page++}))},infiniteFeed:function(t){var e=this;this.feed.length<2?t.complete():axios.get("/api/v0/groups/topics/tag",{params:{gid:this.gid,name:this.name,limit:1,page:this.page}}).then((function(s){if(s.data.length){var o=s.data,a=e;o.forEach((function(t){-1==a.ids.indexOf(t.id)&&(a.ids.push(t.id),a.feed.push(t))})),t.loaded(),e.page++}else t.complete()}))}}}},68717:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>r});var o=s(7764),a=s(66536);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)return;if("string"==typeof t)return n(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return n(t,e)}(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 s=0,o=new Array(e);s<e;s++)o[s]=t[s];return o}const r={props:{groupId:{type:String},profile:{type:Object},status:{type:Object},show:{type:Boolean,default:!1},permalinkMode:{type:Boolean,default:!1},permalinkStatus:{type:Object},canReply:{type:Boolean,default:!0}},components:{"read-more":o.default,"comment-post":a.default},data:function(){return{isLoaded:!1,hide:!1,feed:[],canLoadMore:!1,isLoadingMore:!1,replyContent:null,maxReplyId:null,readMoreCursor:200,avatar:"/storage/avatars/default.png",isUploading:!1,uploadProgress:0,lightboxStatus:null,replyChildId:void 0,replyChildIndex:void 0,childReplyContent:null,postingChildComment:!1,loadingChildComments:!1,replyChildMinId:void 0}},mounted:function(){if(this.permalinkMode&&this.permalinkStatus){var t=this.permalinkStatus;t.reply_count&&(t.children={feed:[],can_load_more:!0}),this.feed.push(t),this.isLoaded=!0,this.canLoadMore=!1}else this.fetchComments();this.profile&&this.profile.hasOwnProperty("avatar")&&(this.avatar=this.profile.avatar)},methods:{fetchComments:function(){var t=this;axios.get("/api/v0/groups/comments",{params:{gid:this.groupId,sid:this.status.id,limit:3}}).then((function(e){var s=e.data.map((function(t){return t.reply_count&&t.reply_count>0&&(t.children={feed:[],can_load_more:!0}),t}));t.feed=s,t.isLoaded=!0,t.maxReplyId=e.data[e.data.length-1].id,3==t.feed.length&&(t.canLoadMore=!0)})).catch((function(e){t.isLoaded=!0}))},loadMoreComments:function(){var t=this;this.isLoadingMore=!0,axios.get("/api/v0/groups/comments",{params:{gid:this.groupId,sid:this.status.id,limit:3,max_id:this.maxReplyId}}).then((function(e){var s;if(e.data[e.data.length-1].id==t.maxReplyId)return t.isLoadingMore=!1,void(t.canLoadMore=!1);(s=t.feed).push.apply(s,i(e.data)),setTimeout((function(){t.isLoadingMore=!1}),500),t.maxReplyId=e.data[e.data.length-1].id,e.data.length>0?t.canLoadMore=!0:t.canLoadMore=!1})).catch((function(e){t.isLoadingMore=!1,t.canLoadMore=!1}))},storeComment:function(t){var e,s=this;null===(e=t.currentTarget)||void 0===e||e.blur(),axios.post("/api/v0/groups/com
|