Profile follow client events (#9385)
* Add parameters to profile:follow Track who was followed, whose profile generated the follow, and the position of the person who was followed in the list * Add profileCard:seen event * Don't send "profileCard:seen" event to Statsig * Clean up * prevent overzealous clearing --------- Co-authored-by: Samuel Newman <mozzius@protonmail.com>
This commit is contained in:
@@ -242,12 +242,19 @@ export function useProfileFollowMutationQueue(
|
||||
profile: Shadow<bsky.profile.AnyProfileView>,
|
||||
logContext: LogEvents['profile:follow']['logContext'] &
|
||||
LogEvents['profile:follow']['logContext'],
|
||||
position?: number,
|
||||
contextProfileDid?: string,
|
||||
) {
|
||||
const agent = useAgent()
|
||||
const queryClient = useQueryClient()
|
||||
const did = profile.did
|
||||
const initialFollowingUri = profile.viewer?.following
|
||||
const followMutation = useProfileFollowMutation(logContext, profile)
|
||||
const followMutation = useProfileFollowMutation(
|
||||
logContext,
|
||||
profile,
|
||||
position,
|
||||
contextProfileDid,
|
||||
)
|
||||
const unfollowMutation = useProfileUnfollowMutation(logContext)
|
||||
|
||||
const queueToggle = useToggleMutationQueue({
|
||||
@@ -314,6 +321,8 @@ export function useProfileFollowMutationQueue(
|
||||
function useProfileFollowMutation(
|
||||
logContext: LogEvents['profile:follow']['logContext'],
|
||||
profile: Shadow<bsky.profile.AnyProfileView>,
|
||||
position?: number,
|
||||
contextProfileDid?: string,
|
||||
) {
|
||||
const {currentAccount} = useSession()
|
||||
const agent = useAgent()
|
||||
@@ -336,7 +345,10 @@ function useProfileFollowMutation(
|
||||
'followersCount' in profile
|
||||
? toClout(profile.followersCount)
|
||||
: undefined,
|
||||
followeeDid: did,
|
||||
followerClout: toClout(ownProfile?.followersCount),
|
||||
position,
|
||||
contextProfileDid,
|
||||
})
|
||||
return await agent.follow(did)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user