From 1e296e79a143c3c1a92a5dbcd0b44eff6163055a Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 1 Feb 2020 19:33:27 +0200 Subject: [PATCH] move pinned statuses from user TL storage to separate pins --- src/components/timeline/timeline.js | 22 +++------------------- src/components/timeline/timeline.vue | 8 +++----- src/modules/statuses.js | 5 +++-- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 9a53acd6..245e0a60 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -3,19 +3,6 @@ import timelineFetcher from '../../services/timeline_fetcher/timeline_fetcher.se import Conversation from '../conversation/conversation.vue' import { throttle, keyBy } from 'lodash' -export const getExcludedStatusIdsByPinning = (statuses, pinnedStatusIds) => { - const ids = [] - if (pinnedStatusIds && pinnedStatusIds.length > 0) { - for (let status of statuses) { - if (!pinnedStatusIds.includes(status.id)) { - break - } - ids.push(status.id) - } - } - return ids -} - const Timeline = { props: [ 'timeline', @@ -60,14 +47,11 @@ const Timeline = { footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : []) } }, - // id map of statuses which need to be hidden in the main list due to pinning logic - excludedStatusIdsObject () { - const ids = getExcludedStatusIdsByPinning(this.timeline.visibleStatuses, this.pinnedStatusIds) - // Convert id array to object - return keyBy(ids) - }, pinnedStatusIdsObject () { return keyBy(this.pinnedStatusIds) + }, + pinnedStatuses () { + return this.$store.state.statuses.timelines.pins.visibleStatuses.filter(status => status.user.id === this.userId) } }, components: { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 9777bd0c..496b4247 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -35,12 +35,11 @@
-