From de0fef8fa05f9341f0a9e8c1459cff6bd18f5d76 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 2 May 2019 21:11:28 -0600 Subject: [PATCH] Update Timeline.vue --- resources/assets/js/components/Timeline.vue | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 92b70c01c..79fad584a 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -419,6 +419,9 @@ fetchProfile() { axios.get('/api/v1/accounts/verify_credentials').then(res => { this.profile = res.data; + if(this.profile.is_admin == true) { + this.modes.mod = true; + } $('.profile-card .loader').addClass('d-none'); $('.profile-card .contents').removeClass('d-none'); $('.profile-card .card-footer').removeClass('d-none'); @@ -653,7 +656,7 @@ }, deletePost(status, index) { - if($('body').hasClass('loggedIn') == false || status.account.id !== this.profile.id) { + if($('body').hasClass('loggedIn') == false || this.ownerOrAdmin(status) == false) { return; } @@ -834,12 +837,12 @@ modeModToggle() { this.modes.mod = !this.modes.mod; - window.ls.set('pixelfed-classicui-settings', this.modes); + //window.ls.set('pixelfed-classicui-settings', this.modes); }, modeNotifyToggle() { this.modes.notify = !this.modes.notify; - window.ls.set('pixelfed-classicui-settings', this.modes); + //window.ls.set('pixelfed-classicui-settings', this.modes); }, modeDarkToggle() { @@ -863,12 +866,12 @@ this.modes.dark = true; }); } - window.ls.set('pixelfed-classicui-settings', this.modes); + //window.ls.set('pixelfed-classicui-settings', this.modes); }, modeInfiniteToggle() { this.modes.infinite = !this.modes.infinite - window.ls.set('pixelfed-classicui-settings', this.modes); + //window.ls.set('pixelfed-classicui-settings', this.modes); }, followingModal() { @@ -991,6 +994,18 @@ 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(); } } }