Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix undefined block (#4479)

* Fix undefined block (#4378)

* Fix undefined block

* Changing text and handling all blocks.

* Tweaks

* Update copy, make non-interactive

* Remove console

* Clarify logic

* Pass through parent blocked state for 3p blocks

* Better translation

---------

Co-authored-by: Josh <hi@oracularhades.com>
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

authored by

Eric Bailey
Josh
Dan Abramov
and committed by
GitHub
ac08c761 2237e10a

+43 -20
+6
src/state/queries/post-feed.ts
··· 78 78 feedContext: string | undefined 79 79 moderation: ModerationDecision 80 80 parentAuthor?: AppBskyActorDefs.ProfileViewBasic 81 + isParentBlocked?: boolean 81 82 } 82 83 83 84 export interface FeedPostSlice { ··· 311 312 const parentAuthor = 312 313 item.reply?.parent?.author ?? 313 314 slice.items[i + 1]?.reply?.grandparentAuthor 315 + const replyRef = item.reply 316 + const isParentBlocked = AppBskyFeedDefs.isBlockedPost( 317 + replyRef?.parent, 318 + ) 314 319 315 320 return { 316 321 _reactKey: `${slice._reactKey}-${i}-${item.post.uri}`, ··· 324 329 feedContext: item.feedContext || slice.feedContext, 325 330 moderation: moderations[i], 326 331 parentAuthor, 332 + isParentBlocked, 327 333 } 328 334 } 329 335 return undefined
+33 -20
src/view/com/posts/FeedItem.tsx
··· 56 56 isThreadParent?: boolean 57 57 feedContext: string | undefined 58 58 hideTopBorder?: boolean 59 + isParentBlocked?: boolean 59 60 } 60 61 61 62 export function FeedItem({ ··· 70 71 isThreadLastChild, 71 72 isThreadParent, 72 73 hideTopBorder, 74 + isParentBlocked, 73 75 }: FeedItemProps & {post: AppBskyFeedDefs.PostView}): React.ReactNode { 74 76 const postShadowed = usePostShadow(post) 75 77 const richText = useMemo( ··· 100 102 isThreadLastChild={isThreadLastChild} 101 103 isThreadParent={isThreadParent} 102 104 hideTopBorder={hideTopBorder} 105 + isParentBlocked={isParentBlocked} 103 106 /> 104 107 ) 105 108 } ··· 119 122 isThreadLastChild, 120 123 isThreadParent, 121 124 hideTopBorder, 125 + isParentBlocked, 122 126 }: FeedItemProps & { 123 127 richText: RichTextAPI 124 128 post: Shadow<AppBskyFeedDefs.PostView> ··· 320 324 onOpenAuthor={onOpenAuthor} 321 325 /> 322 326 {!isThreadChild && showReplyTo && parentAuthor && ( 323 - <ReplyToLabel profile={parentAuthor} /> 327 + <ReplyToLabel blocked={isParentBlocked} profile={parentAuthor} /> 324 328 )} 325 329 <LabelsOnMyPost post={post} /> 326 330 <PostContent ··· 409 413 } 410 414 PostContent = memo(PostContent) 411 415 412 - function ReplyToLabel({profile}: {profile: AppBskyActorDefs.ProfileViewBasic}) { 416 + function ReplyToLabel({ 417 + profile, 418 + blocked, 419 + }: { 420 + profile: AppBskyActorDefs.ProfileViewBasic 421 + blocked?: boolean 422 + }) { 413 423 const pal = usePalette('default') 414 - 415 424 return ( 416 425 <View style={[s.flexRow, s.mb2, s.alignCenter]}> 417 426 <FontAwesomeIcon ··· 424 433 style={[pal.textLight, s.mr2]} 425 434 lineHeight={1.2} 426 435 numberOfLines={1}> 427 - <Trans context="description"> 428 - Reply to{' '} 429 - <ProfileHoverCard inline did={profile.did}> 430 - <TextLinkOnWebOnly 431 - type="md" 432 - style={pal.textLight} 433 - lineHeight={1.2} 434 - numberOfLines={1} 435 - href={makeProfileLink(profile)} 436 - text={ 437 - profile.displayName 438 - ? sanitizeDisplayName(profile.displayName) 439 - : sanitizeHandle(profile.handle) 440 - } 441 - /> 442 - </ProfileHoverCard> 443 - </Trans> 436 + {blocked ? ( 437 + <Trans context="description">Reply to a blocked post</Trans> 438 + ) : ( 439 + <Trans context="description"> 440 + Reply to{' '} 441 + <ProfileHoverCard inline did={profile.did}> 442 + <TextLinkOnWebOnly 443 + type="md" 444 + style={pal.textLight} 445 + lineHeight={1.2} 446 + numberOfLines={1} 447 + href={makeProfileLink(profile)} 448 + text={ 449 + profile.displayName 450 + ? sanitizeDisplayName(profile.displayName) 451 + : sanitizeHandle(profile.handle) 452 + } 453 + /> 454 + </ProfileHoverCard> 455 + </Trans> 456 + )} 444 457 </Text> 445 458 </View> 446 459 )
+4
src/view/com/posts/FeedSlice.tsx
··· 34 34 isThreadParent={isThreadParentAt(slice.items, 0)} 35 35 isThreadChild={isThreadChildAt(slice.items, 0)} 36 36 hideTopBorder={hideTopBorder} 37 + isParentBlocked={slice.items[0].isParentBlocked} 37 38 /> 38 39 <FeedItem 39 40 key={slice.items[1]._reactKey} ··· 46 47 moderation={slice.items[1].moderation} 47 48 isThreadParent={isThreadParentAt(slice.items, 1)} 48 49 isThreadChild={isThreadChildAt(slice.items, 1)} 50 + isParentBlocked={slice.items[1].isParentBlocked} 49 51 /> 50 52 <ViewFullThread slice={slice} /> 51 53 <FeedItem ··· 59 61 moderation={slice.items[last].moderation} 60 62 isThreadParent={isThreadParentAt(slice.items, last)} 61 63 isThreadChild={isThreadChildAt(slice.items, last)} 64 + isParentBlocked={slice.items[2].isParentBlocked} 62 65 isThreadLastChild 63 66 /> 64 67 </> ··· 82 85 isThreadLastChild={ 83 86 isThreadChildAt(slice.items, i) && slice.items.length === i + 1 84 87 } 88 + isParentBlocked={slice.items[i].isParentBlocked} 85 89 hideTopBorder={hideTopBorder && i === 0} 86 90 /> 87 91 ))}