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
This commit is contained in:
@@ -41,6 +41,7 @@ export class FeedViewPostsSlice {
|
|||||||
isFallbackMarker: boolean
|
isFallbackMarker: boolean
|
||||||
isOrphan: boolean
|
isOrphan: boolean
|
||||||
rootUri: string
|
rootUri: string
|
||||||
|
feedPostUri: string
|
||||||
|
|
||||||
constructor(feedPost: FeedViewPost) {
|
constructor(feedPost: FeedViewPost) {
|
||||||
const {post, reply, reason} = feedPost
|
const {post, reply, reason} = feedPost
|
||||||
@@ -48,6 +49,7 @@ export class FeedViewPostsSlice {
|
|||||||
this.isIncompleteThread = false
|
this.isIncompleteThread = false
|
||||||
this.isFallbackMarker = false
|
this.isFallbackMarker = false
|
||||||
this.isOrphan = false
|
this.isOrphan = false
|
||||||
|
this.feedPostUri = post.uri
|
||||||
if (AppBskyFeedDefs.isPostView(reply?.root)) {
|
if (AppBskyFeedDefs.isPostView(reply?.root)) {
|
||||||
this.rootUri = reply.root.uri
|
this.rootUri = reply.root.uri
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -206,11 +206,14 @@ function Feed() {
|
|||||||
feedContext: string | undefined
|
feedContext: string | undefined
|
||||||
}[] = []
|
}[] = []
|
||||||
for (const slice of page.slices) {
|
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({
|
items.push({
|
||||||
_reactKey: i._reactKey,
|
_reactKey: feedPost._reactKey,
|
||||||
moderation: i.moderation,
|
moderation: feedPost.moderation,
|
||||||
post: i.post,
|
post: feedPost.post,
|
||||||
feedContext: slice.feedContext,
|
feedContext: slice.feedContext,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export interface FeedPostSlice {
|
|||||||
isIncompleteThread: boolean
|
isIncompleteThread: boolean
|
||||||
isFallbackMarker: boolean
|
isFallbackMarker: boolean
|
||||||
feedContext: string | undefined
|
feedContext: string | undefined
|
||||||
|
feedPostUri: string
|
||||||
reason?:
|
reason?:
|
||||||
| AppBskyFeedDefs.ReasonRepost
|
| AppBskyFeedDefs.ReasonRepost
|
||||||
| AppBskyFeedDefs.ReasonPin
|
| AppBskyFeedDefs.ReasonPin
|
||||||
@@ -330,6 +331,7 @@ export function usePostFeedQuery(
|
|||||||
isFallbackMarker: slice.isFallbackMarker,
|
isFallbackMarker: slice.isFallbackMarker,
|
||||||
feedContext: slice.feedContext,
|
feedContext: slice.feedContext,
|
||||||
reason: slice.reason,
|
reason: slice.reason,
|
||||||
|
feedPostUri: slice.feedPostUri,
|
||||||
items: slice.items.map((item, i) => {
|
items: slice.items.map((item, i) => {
|
||||||
const feedPostSliceItem: FeedPostSliceItem = {
|
const feedPostSliceItem: FeedPostSliceItem = {
|
||||||
_reactKey: `${slice._reactKey}-${i}-${item.post.uri}`,
|
_reactKey: `${slice._reactKey}-${i}-${item.post.uri}`,
|
||||||
|
|||||||
@@ -347,7 +347,9 @@ let PostFeed = ({
|
|||||||
}[] = []
|
}[] = []
|
||||||
for (const page of data.pages) {
|
for (const page of data.pages) {
|
||||||
for (const slice of page.slices) {
|
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)) {
|
if (item && AppBskyEmbedVideo.isView(item.post.embed)) {
|
||||||
videos.push({item, feedContext: slice.feedContext})
|
videos.push({item, feedContext: slice.feedContext})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user