From f4bd5672b1383984a8eb942680d6846d92915d43 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 19 Oct 2021 19:41:51 -0600 Subject: [PATCH] Update Timeline component, cascade relationship state change --- resources/assets/js/components/Timeline.vue | 28 +++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index cfd59ac62..20002a035 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -12,7 +12,7 @@
-
+
Loading... @@ -106,6 +106,8 @@ size="small" v-on:status-delete="deleteStatus" v-on:comment-focus="commentFocus" + v-on:followed="followedAccount" + v-on:unfollowed="unfollowedAccount" />
@@ -1067,7 +1069,29 @@ this.feed = this.feed.filter(s => { return s.id != status; }); - } + }, + + followedAccount(id) { + this.feed = this.feed.map(s => { + if(s.account.id == id) { + if(s.hasOwnProperty('relationship') && s.relationship.following == false) { + s.relationship.following = true; + } + } + return s; + }); + }, + + unfollowedAccount(id) { + this.feed = this.feed.map(s => { + if(s.account.id == id) { + if(s.hasOwnProperty('relationship') && s.relationship.following == true) { + s.relationship.following = false; + } + } + return s; + }); + }, }, beforeDestroy () {