From e8abe1273b5c860b78b219973c2a2926014c0ca5 Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 24 Apr 2019 14:34:55 -0400 Subject: filter pinned statuses based on pinned entity instead of a separate user entity --- src/components/user_profile/user_profile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/components/user_profile/user_profile.js') diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 0071fa89..176ec228 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -1,4 +1,5 @@ import get from 'lodash/get' +import filter from 'lodash/filter' import UserCard from '../user_card/user_card.vue' import FollowCard from '../follow_card/follow_card.vue' import Timeline from '../timeline/timeline.vue' @@ -41,6 +42,9 @@ const UserProfile = { timeline () { return this.$store.state.statuses.timelines.user }, + pinnedStatuses () { + return filter(this.timeline.statuses, { pinned: true }) + }, favorites () { return this.$store.state.statuses.timelines.favorites }, @@ -54,9 +58,6 @@ const UserProfile = { user () { return this.$store.getters.findUser(this.userId) }, - pinnedStatuses () { - return this.user.pinnedStatusIds.map(id => this.$store.state.statuses.allStatusesObject[id]) - }, isExternal () { return this.$route.name === 'external-user-profile' }, @@ -99,6 +100,7 @@ const UserProfile = { if (this.isUs) { this.$store.dispatch('startFetchingTimeline', { timeline: 'favorites', userId }) } + // Fetch all pinned statuses immediately this.$store.dispatch('fetchPinnedStatuses', userId) }, cleanUp () { -- cgit v1.2.3-70-g09d2