diff options
-rw-r--r-- | src/state/queries/post-feed.ts | 6 | ||||
-rw-r--r-- | src/view/com/posts/FeedItem.tsx | 53 | ||||
-rw-r--r-- | src/view/com/posts/FeedSlice.tsx | 4 |
3 files changed, 43 insertions, 20 deletions
diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 2fb80de37..4e44c1c69 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -78,6 +78,7 @@ export interface FeedPostSliceItem { feedContext: string | undefined moderation: ModerationDecision parentAuthor?: AppBskyActorDefs.ProfileViewBasic + isParentBlocked?: boolean } export interface FeedPostSlice { @@ -311,6 +312,10 @@ export function usePostFeedQuery( const parentAuthor = item.reply?.parent?.author ?? slice.items[i + 1]?.reply?.grandparentAuthor + const replyRef = item.reply + const isParentBlocked = AppBskyFeedDefs.isBlockedPost( + replyRef?.parent, + ) return { _reactKey: `${slice._reactKey}-${i}-${item.post.uri}`, @@ -324,6 +329,7 @@ export function usePostFeedQuery( feedContext: item.feedContext || slice.feedContext, moderation: moderations[i], parentAuthor, + isParentBlocked, } } return undefined diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 675f23a88..cc767a4a3 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -56,6 +56,7 @@ interface FeedItemProps { isThreadParent?: boolean feedContext: string | undefined hideTopBorder?: boolean + isParentBlocked?: boolean } export function FeedItem({ @@ -70,6 +71,7 @@ export function FeedItem({ isThreadLastChild, isThreadParent, hideTopBorder, + isParentBlocked, }: FeedItemProps & {post: AppBskyFeedDefs.PostView}): React.ReactNode { const postShadowed = usePostShadow(post) const richText = useMemo( @@ -100,6 +102,7 @@ export function FeedItem({ isThreadLastChild={isThreadLastChild} isThreadParent={isThreadParent} hideTopBorder={hideTopBorder} + isParentBlocked={isParentBlocked} /> ) } @@ -119,6 +122,7 @@ let FeedItemInner = ({ isThreadLastChild, isThreadParent, hideTopBorder, + isParentBlocked, }: FeedItemProps & { richText: RichTextAPI post: Shadow<AppBskyFeedDefs.PostView> @@ -320,7 +324,7 @@ let FeedItemInner = ({ onOpenAuthor={onOpenAuthor} /> {!isThreadChild && showReplyTo && parentAuthor && ( - <ReplyToLabel profile={parentAuthor} /> + <ReplyToLabel blocked={isParentBlocked} profile={parentAuthor} /> )} <LabelsOnMyPost post={post} /> <PostContent @@ -409,9 +413,14 @@ let PostContent = ({ } PostContent = memo(PostContent) -function ReplyToLabel({profile}: {profile: AppBskyActorDefs.ProfileViewBasic}) { +function ReplyToLabel({ + profile, + blocked, +}: { + profile: AppBskyActorDefs.ProfileViewBasic + blocked?: boolean +}) { const pal = usePalette('default') - return ( <View style={[s.flexRow, s.mb2, s.alignCenter]}> <FontAwesomeIcon @@ -424,23 +433,27 @@ function ReplyToLabel({profile}: {profile: AppBskyActorDefs.ProfileViewBasic}) { style={[pal.textLight, s.mr2]} lineHeight={1.2} numberOfLines={1}> - <Trans context="description"> - Reply to{' '} - <ProfileHoverCard inline did={profile.did}> - <TextLinkOnWebOnly - type="md" - style={pal.textLight} - lineHeight={1.2} - numberOfLines={1} - href={makeProfileLink(profile)} - text={ - profile.displayName - ? sanitizeDisplayName(profile.displayName) - : sanitizeHandle(profile.handle) - } - /> - </ProfileHoverCard> - </Trans> + {blocked ? ( + <Trans context="description">Reply to a blocked post</Trans> + ) : ( + <Trans context="description"> + Reply to{' '} + <ProfileHoverCard inline did={profile.did}> + <TextLinkOnWebOnly + type="md" + style={pal.textLight} + lineHeight={1.2} + numberOfLines={1} + href={makeProfileLink(profile)} + text={ + profile.displayName + ? sanitizeDisplayName(profile.displayName) + : sanitizeHandle(profile.handle) + } + /> + </ProfileHoverCard> + </Trans> + )} </Text> </View> ) diff --git a/src/view/com/posts/FeedSlice.tsx b/src/view/com/posts/FeedSlice.tsx index aeb24e8bb..3e08f253c 100644 --- a/src/view/com/posts/FeedSlice.tsx +++ b/src/view/com/posts/FeedSlice.tsx @@ -34,6 +34,7 @@ let FeedSlice = ({ isThreadParent={isThreadParentAt(slice.items, 0)} isThreadChild={isThreadChildAt(slice.items, 0)} hideTopBorder={hideTopBorder} + isParentBlocked={slice.items[0].isParentBlocked} /> <FeedItem key={slice.items[1]._reactKey} @@ -46,6 +47,7 @@ let FeedSlice = ({ moderation={slice.items[1].moderation} isThreadParent={isThreadParentAt(slice.items, 1)} isThreadChild={isThreadChildAt(slice.items, 1)} + isParentBlocked={slice.items[1].isParentBlocked} /> <ViewFullThread slice={slice} /> <FeedItem @@ -59,6 +61,7 @@ let FeedSlice = ({ moderation={slice.items[last].moderation} isThreadParent={isThreadParentAt(slice.items, last)} isThreadChild={isThreadChildAt(slice.items, last)} + isParentBlocked={slice.items[2].isParentBlocked} isThreadLastChild /> </> @@ -82,6 +85,7 @@ let FeedSlice = ({ isThreadLastChild={ isThreadChildAt(slice.items, i) && slice.items.length === i + 1 } + isParentBlocked={slice.items[i].isParentBlocked} hideTopBorder={hideTopBorder && i === 0} /> ))} |