diff --git a/src/components/FeedInterstitials.tsx b/src/components/FeedInterstitials.tsx index 501eac57..243db0a4 100644 --- a/src/components/FeedInterstitials.tsx +++ b/src/components/FeedInterstitials.tsx @@ -212,6 +212,7 @@ export function SuggestedFollows() { /> - + @@ -273,11 +278,13 @@ export function FollowButton(props: FollowButtonProps) { export function FollowButtonInner({ profile: profileUnshadowed, + moderationOpts, logContext, ...rest }: FollowButtonProps) { const {_} = useLingui() const profile = useProfileShadow(profileUnshadowed) + const moderation = moderateProfile(profile, moderationOpts) const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue( profile, logContext, @@ -289,6 +296,14 @@ export function FollowButtonInner({ e.stopPropagation() try { await queueFollow() + Toast.show( + _( + msg`Following ${sanitizeDisplayName( + profile.displayName || profile.handle, + moderation.ui('displayName'), + )}`, + ), + ) } catch (e: any) { if (e?.name !== 'AbortError') { Toast.show(_(msg`An issue occurred, please try again.`)) @@ -301,6 +316,14 @@ export function FollowButtonInner({ e.stopPropagation() try { await queueUnfollow() + Toast.show( + _( + msg`No longer following ${sanitizeDisplayName( + profile.displayName || profile.handle, + moderation.ui('displayName'), + )}`, + ), + ) } catch (e: any) { if (e?.name !== 'AbortError') { Toast.show(_(msg`An issue occurred, please try again.`)) diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index d9a2c6bb..1f866d26 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -3,6 +3,7 @@ import {Image as RNImage} from 'react-native-image-crop-picker' import { AppBskyActorDefs, AppBskyActorGetProfile, + AppBskyActorGetProfiles, AppBskyActorProfile, AtUri, BskyAgent, @@ -516,11 +517,11 @@ export function* findAllProfilesInQueryData( queryClient: QueryClient, did: string, ): Generator { - const queryDatas = + const profileQueryDatas = queryClient.getQueriesData({ queryKey: [RQKEY_ROOT], }) - for (const [_queryKey, queryData] of queryDatas) { + for (const [_queryKey, queryData] of profileQueryDatas) { if (!queryData) { continue } @@ -528,6 +529,20 @@ export function* findAllProfilesInQueryData( yield queryData } } + const profilesQueryDatas = + queryClient.getQueriesData({ + queryKey: [profilesQueryKeyRoot], + }) + for (const [_queryKey, queryData] of profilesQueryDatas) { + if (!queryData) { + continue + } + for (let profile of queryData.profiles) { + if (profile.did === did) { + yield profile + } + } + } } export function findProfileQueryData(