From 2d339cd3b8b3ffc1509c954f68636d8ed4d37253 Mon Sep 17 00:00:00 2001 From: Brenden Bice Date: Mon, 1 Apr 2019 22:29:45 -0400 Subject: fetch favorited users --- src/components/conversation/conversation.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 30600f73..b3335f64 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -120,6 +120,8 @@ const conversation = { if (this.status) { this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id}) .then(({ancestors, descendants}) => { + const ancestorId = ancestors.length ? ancestors[0].id : this.status.id + this.fetchFavouritedByUsers(ancestorId) this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) }) @@ -148,6 +150,16 @@ const conversation = { if (!this.expanded) { this.setHighlight(null) } + }, + fetchFavouritedByUsers (id) { + this.$store.state.api.backendInteractor.fetchFavouritedByUsers({id: this.status.id}).then((response) => { + const favoritedByUsers = response.map(item => ({ + src: item.avatar_static, + name: item.display_name + })) + this.$store.dispatch('addFavoritedByUsers', { favoritedByUsers, id }) + }) + }, } } } -- cgit v1.2.3-70-g09d2