Update Timeline component, cascade relationship state change

This commit is contained in:
Daniel Supernault 2021-10-19 19:41:51 -06:00
parent 0436b124e4
commit f4bd5672b1
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -12,7 +12,7 @@
<div style="margin-top:-2px;"> <div style="margin-top:-2px;">
<story-component v-if="config.features.stories" :scope="scope"></story-component> <story-component v-if="config.features.stories" :scope="scope"></story-component>
</div> </div>
<div> <div class="pt-4">
<div v-if="loading" class="text-center" style="padding-top:10px;"> <div v-if="loading" class="text-center" style="padding-top:10px;">
<div class="spinner-border" role="status"> <div class="spinner-border" role="status">
<span class="sr-only">Loading...</span> <span class="sr-only">Loading...</span>
@ -106,6 +106,8 @@
size="small" size="small"
v-on:status-delete="deleteStatus" v-on:status-delete="deleteStatus"
v-on:comment-focus="commentFocus" v-on:comment-focus="commentFocus"
v-on:followed="followedAccount"
v-on:unfollowed="unfollowedAccount"
/> />
</div> </div>
@ -1067,7 +1069,29 @@
this.feed = this.feed.filter(s => { this.feed = this.feed.filter(s => {
return s.id != status; 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 () { beforeDestroy () {