From a71134f467449bc4c74967ca3958416feac6b91d Mon Sep 17 00:00:00 2001 From: Minseo Lee Date: Fri, 12 Jul 2024 11:42:27 +0900 Subject: `Reposted by you` and `Reply to you` (#4478) Co-authored-by: Hailey --- src/view/com/post/Post.tsx | 30 +++++++++++------- src/view/com/posts/FeedItem.tsx | 67 ++++++++++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index 51a1381ec..a05339d4d 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -15,6 +15,7 @@ import {useQueryClient} from '@tanstack/react-query' import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' import {POST_TOMBSTONE, Shadow, usePostShadow} from '#/state/cache/post-shadow' import {useModerationOpts} from '#/state/preferences/moderation-opts' +import {useSession} from '#/state/session' import {useComposerControls} from '#/state/shell/composer' import {MAX_POST_LINES} from 'lib/constants' import {usePalette} from 'lib/hooks/usePalette' @@ -145,6 +146,9 @@ function PostInner({ precacheProfile(queryClient, post.author) }, [queryClient, post.author]) + const {currentAccount} = useSession() + const isMe = replyAuthorDid === currentAccount?.did + return ( - - Reply to{' '} - - - - + {isMe ? ( + Reply to you + ) : ( + + Reply to{' '} + + + + + )} )} diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index cc767a4a3..a59eeea52 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -43,6 +43,7 @@ import {Text} from '../util/text/Text' import {PreviewableUserAvatar} from '../util/UserAvatar' import {AviFollowButton} from './AviFollowButton' import hairlineWidth = StyleSheet.hairlineWidth +import {useSession} from '#/state/session' import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost' interface FeedItemProps { @@ -200,6 +201,11 @@ let FeedItemInner = ({ }, ] + const {currentAccount} = useSession() + const isOwner = + AppBskyFeedDefs.isReasonRepost(reason) && + reason.by.did === currentAccount?.did + return ( - - Reposted by{' '} - - - - + {isOwner ? ( + Reposted by you + ) : ( + + Reposted by{' '} + + + + + )} ) : null} @@ -421,6 +435,9 @@ function ReplyToLabel({ blocked?: boolean }) { const pal = usePalette('default') + const {currentAccount} = useSession() + const isMe = profile.did === currentAccount?.did + return ( - {blocked ? ( + {isMe ? ( + Reply to you + ) : blocked ? ( Reply to a blocked post ) : ( -- cgit 1.4.1