mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 16:23:16 +00:00
1 line
72 KiB
JavaScript
1 line
72 KiB
JavaScript
|
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[529],{43209:(t,e,a)=>{a.r(e),a.d(e,{default:()=>C});var s=a(79984),i=a(78277),n=a(17108),o=a(95002),r=a(87223),l=a(48204),c=a(9716),d=a(20524),u=a(13094),p=a(58753),m=a(54451),f=a(94559),v=a(19413),h=a(26679),g=a(49268);function b(t){return function(t){if(Array.isArray(t))return _(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 _(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _(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 _(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,s=new Array(e);a<e;a++)s[a]=t[a];return s}const C={props:{groupId:{type:String},path:{type:String},permalinkMode:{type:Boolean,default:!1},permalinkId:{type:String}},components:{"status-card":s.default,"group-about":r.default,"group-status":o.default,"group-members":i.default,"group-compose":n.default,"group-topics":d.default,"group-info-card":u.default,"group-media":l.default,"group-moderation":c.default,"leave-group":p.default,"group-insights":m.default,"search-modal":f.default,"invite-modal":v.default,sidebar:h.default,"group-banner":g.default},data:function(){return{initalLoad:!1,profile:void 0,group:{},isMember:!1,isAdmin:!1,tab:"feed",requestingMembership:!1,composeText:null,feed:[],ids:[],maxId:null,status:void 0,likes:[],likesPage:1,likesId:void 0,atabs:{moderation_count:0,request_count:0}}},mounted:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.fetchGroup()})).catch((function(t){window.location.href="/login?_next="+encodeURIComponent(window.location.href)})),this.permalinkMode?this.fetchPermalink():this.fetchFeed()},methods:{initObservers:function(){},fetchGroup:function(){var t=this;axios.get("/api/v0/groups/"+this.groupId).then((function(e){t.group=e.data,t.isMember=e.data.self.is_member,t.isAdmin=["founder","admin"].includes(e.data.self.role),t.isAdmin&&t.fetchAdminTabs(),t.path?t.isMember&&["about","topics","members","events","media","polls"].includes(t.path)||t.isAdmin&&["insights","moderation"].includes(t.path)?setTimeout((function(){t.tab=t.path,t.initalLoad=!0}),500):(history.pushState(null,null,t.group.url),t.initalLoad=!0):t.initalLoad=!0})).catch((function(t){}))},fetchAdminTabs:function(){var t=this;axios.get("/api/v0/groups/"+this.groupId+"/atabs").then((function(e){t.atabs=e.data}))},fetchFeed:function(){var t=this;axios.get("/api/v0/groups/"+this.groupId+"/feed").then((function(e){var a=t;e.data&&e.data.length&&(t.feed=e.data,t.maxId=t.feed[t.feed.length-1].id,e.data.forEach((function(t){-1==a.ids.indexOf(t.id)&&a.ids.push(t.id)}))),t.initObservers()}))},fetchPermalink:function(){var t=this;axios.get("/api/v0/groups/status",{params:{gid:this.groupId,sid:this.permalinkId}}).then((function(e){t.status=e.data,t.status.in_reply_to_id&&(t.status.showCommentDrawer=!0)})).catch((function(e){t.permalinkMode=!1,t.fetchFeed()}))},timestampFormat:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=new Date(t);return e?a.toDateString()+" · "+a.toLocaleTimeString():a.toDateString()},switchTab:function(t){window.scrollTo(0,0),"feed"==t&&this.permalinkMode&&(this.permalinkMode=!1,this.fetchFeed());var e="feed"==t?this.group.url:this.group.url+"/"+t;history.pushState(t,null,e),this.tab=t},joinGroup:function(){var t=this;this.requestingMembership=!0,axios.post("/api/v0/groups/"+this.groupId+"/join").then((function(e){t.requestingMembership=!1,t.group=e.data,t.fetchGroup(),t.fetchFeed()})).catch((function(e){var a=e.response;422==a.status&&(t.tab="feed",history.pushState("",null,t.group.url),t.requestingMembership=!1,sw
|