From 2a97bdb39d7533ae55ddb0713d4fb3d670017ea5 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 20 Feb 2022 00:04:47 +0200
Subject: fix pinned statuses appearing at the bottom of user timeline (and
 possibly fetching new ones there)

---
 src/components/timeline/timeline.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/timeline/timeline.vue')

diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index 767428f0..c8cd38e0 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -37,7 +37,7 @@
         </template>
         <template v-for="status in timeline.visibleStatuses">
           <conversation
-            v-if="!excludedStatusIdsObject[status.id]"
+            v-if="status._meta.fetchedFromPinned <= 0"
             :key="status.id"
             class="status-fadein"
             :status-id="status.id"
-- 
cgit v1.2.3-70-g09d2


From a31ff20f50906f70253bf43f4548c0f5b0ab8db4 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 20 Feb 2022 00:36:21 +0200
Subject: lol, lmao, that was some shit, this is much easier and works all the
 time

---
 src/components/timeline/timeline.js  | 18 ------------------
 src/components/timeline/timeline.vue |  2 +-
 src/modules/statuses.js              | 32 ++------------------------------
 3 files changed, 3 insertions(+), 49 deletions(-)

(limited to 'src/components/timeline/timeline.vue')

diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 44f749c3..04f0e7d6 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -12,19 +12,6 @@ library.add(
   faCog
 )
 
-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',
@@ -77,11 +64,6 @@ const Timeline = {
       }
     },
     // 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)
     },
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index c8cd38e0..3ba5e8b5 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -37,7 +37,7 @@
         </template>
         <template v-for="status in timeline.visibleStatuses">
           <conversation
-            v-if="status._meta.fetchedFromPinned <= 0"
+            v-if="timelineName === 'bookmarks' || (status.id >= timeline.minId && status.id <= timeline.maxId)"
             :key="status.id"
             class="status-fadein"
             :status-id="status.id"
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 4a968d1f..ac5d25c4 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -84,7 +84,7 @@ const mergeOrAdd = (arr, obj, item) => {
     // We already have this, so only merge the new info.
     // We ignore null values to avoid overwriting existing properties with missing data
     // we also skip 'user' because that is handled by users module
-    merge(oldItem, omitBy(item, (v, k) => v === null || k === 'user' || k === '_meta'))
+    merge(oldItem, omitBy(item, (v, k) => v === null || k === 'user'))
     // Reactivity fix.
     oldItem.attachments.splice(oldItem.attachments.length)
     return { item: oldItem, new: false }
@@ -122,22 +122,6 @@ const sortTimeline = (timeline) => {
 
 // Add status to the global storages (arrays and objects maintaining statuses) except timelines
 const addStatusToGlobalStorage = (state, data) => {
-  // POST METADATA PROCESSING.
-  // In this context "metadata" means all the sidechannel information about the post that we have
-  // i.e. where post was obtained from (which endpoint), what timestamp was etc. anything that isn't
-  // directly attached into it by server.
-  //
-  // @@_meta.fetchedFromPinned: number
-  // -1 = fetched from elsewhere
-  // +1 = fetched from pinned posts
-  // 0 = fetched from elsewhere and from pinned posts
-  //
-  // The logic is mainly for user profile page - don't show post in timeline context
-  // if post was ONLY fetched from pinned posts, show it if it was obtained from
-  // elsewhere (i.e. user posts fetching)
-  data._meta = data._meta || {}
-  data._meta.fetchedFromPinned = data._meta.fetchedFromPinned || -1
-
   const result = mergeOrAdd(state.allStatuses, state.allStatusesObject, data)
   if (result.new) {
     // Add to conversation
@@ -149,18 +133,6 @@ const addStatusToGlobalStorage = (state, data) => {
     } else {
       set(conversationsObject, conversationId, [status])
     }
-  } else {
-    // If post was fetched from elsewhere AND from pinned (=0 we don't care anymore)
-    // otherwise we sum the old data and new data and clamp it to [-1; 1]
-    if (result.item._meta.fetchedFromPinned !== 0) {
-      result.item._meta.fetchedFromPinned = Math.min(
-        1,
-        Math.max(
-          -1,
-          result.item._meta.fetchedFromPinned + data._meta.fetchedFromPinned
-        )
-      )
-    }
   }
   return result
 }
@@ -654,7 +626,7 @@ const statuses = {
     },
     fetchPinnedStatuses ({ rootState, dispatch }, userId) {
       rootState.api.backendInteractor.fetchPinnedStatuses({ id: userId })
-        .then(statuses => dispatch('addNewStatuses', { statuses: statuses.map(status => ({ ...status, _meta: { fetchedFromPinned: 1 } })), timeline: 'user', userId, showImmediately: true, noIdUpdate: true }))
+        .then(statuses => dispatch('addNewStatuses', { statuses, timeline: 'user', userId, showImmediately: true, noIdUpdate: true }))
     },
     pinStatus ({ rootState, dispatch }, statusId) {
       return rootState.api.backendInteractor.pinOwnStatus({ id: statusId })
-- 
cgit v1.2.3-70-g09d2


From 7b60adb480bdbce856c94164222820fcf8dede02 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 20 Feb 2022 00:57:31 +0200
Subject: only for user TL

---
 src/components/timeline/timeline.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/timeline/timeline.vue')

diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index 3ba5e8b5..ff16208d 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -37,7 +37,7 @@
         </template>
         <template v-for="status in timeline.visibleStatuses">
           <conversation
-            v-if="timelineName === 'bookmarks' || (status.id >= timeline.minId && status.id <= timeline.maxId)"
+            v-if="timelineName !== 'user' || (status.id >= timeline.minId && status.id <= timeline.maxId)"
             :key="status.id"
             class="status-fadein"
             :status-id="status.id"
-- 
cgit v1.2.3-70-g09d2

