Fix orphaned feed slices, handle blocks (#4944)
* Fix orphaned feed slices, handle blocks * Revert to filerting out orphan threads * Support NotFoundPost views too * Just kidding, use ReplyRef.root as source of grandparent data * Fixes
This commit is contained in:
parent
2939ee7df7
commit
3976d6738b
4 changed files with 48 additions and 8 deletions
|
@ -63,6 +63,7 @@ interface FeedItemProps {
|
|||
feedContext: string | undefined
|
||||
hideTopBorder?: boolean
|
||||
isParentBlocked?: boolean
|
||||
isParentNotFound?: boolean
|
||||
}
|
||||
|
||||
export function FeedItem({
|
||||
|
@ -78,6 +79,7 @@ export function FeedItem({
|
|||
isThreadParent,
|
||||
hideTopBorder,
|
||||
isParentBlocked,
|
||||
isParentNotFound,
|
||||
}: FeedItemProps & {post: AppBskyFeedDefs.PostView}): React.ReactNode {
|
||||
const postShadowed = usePostShadow(post)
|
||||
const richText = useMemo(
|
||||
|
@ -109,6 +111,7 @@ export function FeedItem({
|
|||
isThreadParent={isThreadParent}
|
||||
hideTopBorder={hideTopBorder}
|
||||
isParentBlocked={isParentBlocked}
|
||||
isParentNotFound={isParentNotFound}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -129,6 +132,7 @@ let FeedItemInner = ({
|
|||
isThreadParent,
|
||||
hideTopBorder,
|
||||
isParentBlocked,
|
||||
isParentNotFound,
|
||||
}: FeedItemProps & {
|
||||
richText: RichTextAPI
|
||||
post: Shadow<AppBskyFeedDefs.PostView>
|
||||
|
@ -344,9 +348,14 @@ let FeedItemInner = ({
|
|||
postHref={href}
|
||||
onOpenAuthor={onOpenAuthor}
|
||||
/>
|
||||
{showReplyTo && (parentAuthor || isParentBlocked) && (
|
||||
<ReplyToLabel blocked={isParentBlocked} profile={parentAuthor} />
|
||||
)}
|
||||
{showReplyTo &&
|
||||
(parentAuthor || isParentBlocked || isParentNotFound) && (
|
||||
<ReplyToLabel
|
||||
blocked={isParentBlocked}
|
||||
notFound={isParentNotFound}
|
||||
profile={parentAuthor}
|
||||
/>
|
||||
)}
|
||||
<LabelsOnMyPost post={post} />
|
||||
<PostContent
|
||||
moderation={moderation}
|
||||
|
@ -438,9 +447,11 @@ PostContent = memo(PostContent)
|
|||
function ReplyToLabel({
|
||||
profile,
|
||||
blocked,
|
||||
notFound,
|
||||
}: {
|
||||
profile: AppBskyActorDefs.ProfileViewBasic | undefined
|
||||
blocked?: boolean
|
||||
notFound?: boolean
|
||||
}) {
|
||||
const pal = usePalette('default')
|
||||
const {currentAccount} = useSession()
|
||||
|
@ -448,6 +459,8 @@ function ReplyToLabel({
|
|||
let label
|
||||
if (blocked) {
|
||||
label = <Trans context="description">Reply to a blocked post</Trans>
|
||||
} else if (notFound) {
|
||||
label = <Trans context="description">Reply to an unknown post</Trans>
|
||||
} else if (profile != null) {
|
||||
const isMe = profile.did === currentAccount?.did
|
||||
if (isMe) {
|
||||
|
|
|
@ -36,6 +36,7 @@ let FeedSlice = ({
|
|||
isThreadChild={isThreadChildAt(slice.items, 0)}
|
||||
hideTopBorder={hideTopBorder}
|
||||
isParentBlocked={slice.items[0].isParentBlocked}
|
||||
isParentNotFound={slice.items[0].isParentNotFound}
|
||||
/>
|
||||
<ViewFullThread uri={slice.items[0].uri} />
|
||||
<FeedItem
|
||||
|
@ -53,6 +54,7 @@ let FeedSlice = ({
|
|||
isThreadParent={isThreadParentAt(slice.items, beforeLast)}
|
||||
isThreadChild={isThreadChildAt(slice.items, beforeLast)}
|
||||
isParentBlocked={slice.items[beforeLast].isParentBlocked}
|
||||
isParentNotFound={slice.items[beforeLast].isParentNotFound}
|
||||
/>
|
||||
<FeedItem
|
||||
key={slice.items[last]._reactKey}
|
||||
|
@ -66,6 +68,7 @@ let FeedSlice = ({
|
|||
isThreadParent={isThreadParentAt(slice.items, last)}
|
||||
isThreadChild={isThreadChildAt(slice.items, last)}
|
||||
isParentBlocked={slice.items[last].isParentBlocked}
|
||||
isParentNotFound={slice.items[last].isParentNotFound}
|
||||
isThreadLastChild
|
||||
/>
|
||||
</>
|
||||
|
@ -90,6 +93,7 @@ let FeedSlice = ({
|
|||
isThreadChildAt(slice.items, i) && slice.items.length === i + 1
|
||||
}
|
||||
isParentBlocked={slice.items[i].isParentBlocked}
|
||||
isParentNotFound={slice.items[i].isParentNotFound}
|
||||
hideTopBorder={hideTopBorder && i === 0}
|
||||
/>
|
||||
))}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue