reply button in feeds opens thread (#9143)
* the reply button should open the replies to a post, not present a text input for you to enter your Big Thought into. i think a lot of people don’t even realize that the point has already been written * Feature gate, fix event --------- Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -7,6 +7,7 @@ export type Gate =
|
|||||||
| 'debug_subscriptions'
|
| 'debug_subscriptions'
|
||||||
| 'disable_onboarding_policy_update_notice'
|
| 'disable_onboarding_policy_update_notice'
|
||||||
| 'explore_show_suggested_feeds'
|
| 'explore_show_suggested_feeds'
|
||||||
|
| 'feed_reply_button_open_thread'
|
||||||
| 'old_postonboarding'
|
| 'old_postonboarding'
|
||||||
| 'onboarding_add_video_feed'
|
| 'onboarding_add_video_feed'
|
||||||
| 'onboarding_suggested_accounts'
|
| 'onboarding_suggested_accounts'
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
import {useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useActorStatus} from '#/lib/actor-status'
|
import {useActorStatus} from '#/lib/actor-status'
|
||||||
@@ -19,6 +20,8 @@ import {MAX_POST_LINES} from '#/lib/constants'
|
|||||||
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
|
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {makeProfileLink} from '#/lib/routes/links'
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
|
import {type NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {useGate} from '#/lib/statsig/statsig'
|
||||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
import {countLines} from '#/lib/strings/helpers'
|
import {countLines} from '#/lib/strings/helpers'
|
||||||
@@ -167,35 +170,50 @@ let FeedItemInner = ({
|
|||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {openComposer} = useOpenComposer()
|
const {openComposer} = useOpenComposer()
|
||||||
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const gate = useGate()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
const [hover, setHover] = useState(false)
|
const [hover, setHover] = useState(false)
|
||||||
|
|
||||||
const href = useMemo(() => {
|
const [href, rkey] = useMemo(() => {
|
||||||
const urip = new AtUri(post.uri)
|
const urip = new AtUri(post.uri)
|
||||||
return makeProfileLink(post.author, 'post', urip.rkey)
|
return [makeProfileLink(post.author, 'post', urip.rkey), urip.rkey]
|
||||||
}, [post.uri, post.author])
|
}, [post.uri, post.author])
|
||||||
const {sendInteraction, feedSourceInfo} = useFeedFeedbackContext()
|
const {sendInteraction, feedSourceInfo} = useFeedFeedbackContext()
|
||||||
|
|
||||||
const onPressReply = () => {
|
const onPressReply = () => {
|
||||||
sendInteraction({
|
if (gate('feed_reply_button_open_thread')) {
|
||||||
item: post.uri,
|
sendInteraction({
|
||||||
event: 'app.bsky.feed.defs#interactionReply',
|
item: post.uri,
|
||||||
feedContext,
|
event: 'app.bsky.feed.defs#clickthroughItem',
|
||||||
reqId,
|
feedContext,
|
||||||
})
|
reqId,
|
||||||
openComposer({
|
})
|
||||||
replyTo: {
|
navigation.navigate('PostThread', {
|
||||||
uri: post.uri,
|
name: post.author.did,
|
||||||
cid: post.cid,
|
rkey,
|
||||||
text: record.text || '',
|
})
|
||||||
author: post.author,
|
} else {
|
||||||
embed: post.embed,
|
sendInteraction({
|
||||||
moderation,
|
item: post.uri,
|
||||||
langs: record.langs,
|
event: 'app.bsky.feed.defs#interactionReply',
|
||||||
},
|
feedContext,
|
||||||
})
|
reqId,
|
||||||
|
})
|
||||||
|
openComposer({
|
||||||
|
replyTo: {
|
||||||
|
uri: post.uri,
|
||||||
|
cid: post.cid,
|
||||||
|
text: record.text || '',
|
||||||
|
author: post.author,
|
||||||
|
embed: post.embed,
|
||||||
|
moderation,
|
||||||
|
langs: record.langs,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onOpenAuthor = () => {
|
const onOpenAuthor = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user