1
0
Fork 0
forked from mirror/pixelfed

Update Timeline.vue

This commit is contained in:
Daniel Supernault 2019-05-02 21:11:28 -06:00
parent e0b3866b41
commit de0fef8fa0
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -419,6 +419,9 @@
fetchProfile() { fetchProfile() {
axios.get('/api/v1/accounts/verify_credentials').then(res => { axios.get('/api/v1/accounts/verify_credentials').then(res => {
this.profile = res.data; this.profile = res.data;
if(this.profile.is_admin == true) {
this.modes.mod = true;
}
$('.profile-card .loader').addClass('d-none'); $('.profile-card .loader').addClass('d-none');
$('.profile-card .contents').removeClass('d-none'); $('.profile-card .contents').removeClass('d-none');
$('.profile-card .card-footer').removeClass('d-none'); $('.profile-card .card-footer').removeClass('d-none');
@ -653,7 +656,7 @@
}, },
deletePost(status, index) { deletePost(status, index) {
if($('body').hasClass('loggedIn') == false || status.account.id !== this.profile.id) { if($('body').hasClass('loggedIn') == false || this.ownerOrAdmin(status) == false) {
return; return;
} }
@ -834,12 +837,12 @@
modeModToggle() { modeModToggle() {
this.modes.mod = !this.modes.mod; this.modes.mod = !this.modes.mod;
window.ls.set('pixelfed-classicui-settings', this.modes); //window.ls.set('pixelfed-classicui-settings', this.modes);
}, },
modeNotifyToggle() { modeNotifyToggle() {
this.modes.notify = !this.modes.notify; this.modes.notify = !this.modes.notify;
window.ls.set('pixelfed-classicui-settings', this.modes); //window.ls.set('pixelfed-classicui-settings', this.modes);
}, },
modeDarkToggle() { modeDarkToggle() {
@ -863,12 +866,12 @@
this.modes.dark = true; this.modes.dark = true;
}); });
} }
window.ls.set('pixelfed-classicui-settings', this.modes); //window.ls.set('pixelfed-classicui-settings', this.modes);
}, },
modeInfiniteToggle() { modeInfiniteToggle() {
this.modes.infinite = !this.modes.infinite this.modes.infinite = !this.modes.infinite
window.ls.set('pixelfed-classicui-settings', this.modes); //window.ls.set('pixelfed-classicui-settings', this.modes);
}, },
followingModal() { followingModal() {
@ -991,6 +994,18 @@
this.following.splice(index, 1); this.following.splice(index, 1);
} }
}) })
},
owner(status) {
return this.profile.id === status.account.id;
},
admin() {
return this.profile.is_admin == true;
},
ownerOrAdmin(status) {
return this.owner(status) || this.admin();
} }
} }
} }