[🐴] send record via link in text (Record DMs - base PR) (#4227)
* send record via link in text * re-trim text after removing link
This commit is contained in:
parent
455937dd0f
commit
8eb3cebb36
7 changed files with 99 additions and 51 deletions
|
@ -10,16 +10,12 @@ import {
|
|||
} from 'react-native'
|
||||
import {Image as RNImage} from 'react-native-image-crop-picker'
|
||||
import {LinearGradient} from 'expo-linear-gradient'
|
||||
import {
|
||||
AppBskyGraphDefs,
|
||||
AppBskyRichtextFacet,
|
||||
RichText as RichTextAPI,
|
||||
} from '@atproto/api'
|
||||
import {AppBskyGraphDefs, RichText as RichTextAPI} from '@atproto/api'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
||||
import {shortenLinks} from '#/lib/strings/rich-text-manip'
|
||||
import {shortenLinks, stripInvalidMentions} from '#/lib/strings/rich-text-manip'
|
||||
import {useModalControls} from '#/state/modals'
|
||||
import {
|
||||
useListCreateMutation,
|
||||
|
@ -159,17 +155,7 @@ export function Component({
|
|||
|
||||
await richText.detectFacets(agent)
|
||||
richText = shortenLinks(richText)
|
||||
|
||||
// filter out any mention facets that didn't map to a user
|
||||
richText.facets = richText.facets?.filter(facet => {
|
||||
const mention = facet.features.find(feature =>
|
||||
AppBskyRichtextFacet.isMention(feature),
|
||||
)
|
||||
if (mention && !mention.did) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
richText = stripInvalidMentions(richText)
|
||||
|
||||
if (list) {
|
||||
await listMetadataMutation.mutateAsync({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue