about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Kanich <kaytwo@gmail.com>2025-01-21 14:08:37 -0600
committerGitHub <noreply@github.com>2025-01-21 20:08:37 +0000
commit8e00f044fea7bd3f430b176a5226a725245428eb (patch)
tree9536ed21abb71d96ac3cbaa151e0ba68387f3b4a
parent45b5af604a17c42a9999ed94b8e981259f2cc2d1 (diff)
downloadvoidsky-8e00f044fea7bd3f430b176a5226a725245428eb.tar.zst
show video feeds from posts even if they are replies (#7516)
* show video feeds from posts even if they are replies

* only show feed post in VideoFeed
-rw-r--r--src/lib/api/feed-manip.ts2
-rw-r--r--src/screens/VideoFeed/index.tsx11
-rw-r--r--src/state/queries/post-feed.ts2
-rw-r--r--src/view/com/posts/PostFeed.tsx4
4 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts
index 0eca8b165..4aa20fd12 100644
--- a/src/lib/api/feed-manip.ts
+++ b/src/lib/api/feed-manip.ts
@@ -41,6 +41,7 @@ export class FeedViewPostsSlice {
   isFallbackMarker: boolean
   isOrphan: boolean
   rootUri: string
+  feedPostUri: string
 
   constructor(feedPost: FeedViewPost) {
     const {post, reply, reason} = feedPost
@@ -48,6 +49,7 @@ export class FeedViewPostsSlice {
     this.isIncompleteThread = false
     this.isFallbackMarker = false
     this.isOrphan = false
+    this.feedPostUri = post.uri
     if (AppBskyFeedDefs.isPostView(reply?.root)) {
       this.rootUri = reply.root.uri
     } else {
diff --git a/src/screens/VideoFeed/index.tsx b/src/screens/VideoFeed/index.tsx
index b8403b737..3f89ed927 100644
--- a/src/screens/VideoFeed/index.tsx
+++ b/src/screens/VideoFeed/index.tsx
@@ -206,11 +206,14 @@ function Feed() {
             feedContext: string | undefined
           }[] = []
           for (const slice of page.slices) {
-            for (const i of slice.items) {
+            const feedPost = slice.items.find(
+              item => item.uri === slice.feedPostUri,
+            )
+            if (feedPost) {
               items.push({
-                _reactKey: i._reactKey,
-                moderation: i.moderation,
-                post: i.post,
+                _reactKey: feedPost._reactKey,
+                moderation: feedPost.moderation,
+                post: feedPost.post,
                 feedContext: slice.feedContext,
               })
             }
diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts
index 6f9af18f0..72d6861d6 100644
--- a/src/state/queries/post-feed.ts
+++ b/src/state/queries/post-feed.ts
@@ -89,6 +89,7 @@ export interface FeedPostSlice {
   isIncompleteThread: boolean
   isFallbackMarker: boolean
   feedContext: string | undefined
+  feedPostUri: string
   reason?:
     | AppBskyFeedDefs.ReasonRepost
     | AppBskyFeedDefs.ReasonPin
@@ -330,6 +331,7 @@ export function usePostFeedQuery(
                     isFallbackMarker: slice.isFallbackMarker,
                     feedContext: slice.feedContext,
                     reason: slice.reason,
+                    feedPostUri: slice.feedPostUri,
                     items: slice.items.map((item, i) => {
                       const feedPostSliceItem: FeedPostSliceItem = {
                         _reactKey: `${slice._reactKey}-${i}-${item.post.uri}`,
diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx
index 4bd971b3f..67ecfa25a 100644
--- a/src/view/com/posts/PostFeed.tsx
+++ b/src/view/com/posts/PostFeed.tsx
@@ -347,7 +347,9 @@ let PostFeed = ({
           }[] = []
           for (const page of data.pages) {
             for (const slice of page.slices) {
-              const item = slice.items.at(0)
+              const item = slice.items.find(
+                item => item.uri === slice.feedPostUri,
+              )
               if (item && AppBskyEmbedVideo.isView(item.post.embed)) {
                 videos.push({item, feedContext: slice.feedContext})
               }