Use composer state as source of truth for embeds/links on publish (#5606)
Co-authored-by: Mary <git@mary.my.id> Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
@@ -425,8 +425,6 @@ export const ComposePost = ({
|
||||
composerState, // TODO: move more state here.
|
||||
rawText: richtext.text,
|
||||
replyTo: replyTo?.uri,
|
||||
quote,
|
||||
extLink,
|
||||
labels,
|
||||
threadgate: threadgateAllowUISettings,
|
||||
postgate,
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {ImagePickerAsset} from 'expo-image-picker'
|
||||
|
||||
import {isBskyPostUrl} from '#/lib/strings/url-helpers'
|
||||
import {
|
||||
isBskyPostUrl,
|
||||
postUriToRelativePath,
|
||||
toBskyAppUrl,
|
||||
} from '#/lib/strings/url-helpers'
|
||||
import {ComposerImage, createInitialImages} from '#/state/gallery'
|
||||
import {Gif} from '#/state/queries/tenor'
|
||||
import {ComposerOpts} from '#/state/shell/composer'
|
||||
@@ -29,7 +33,7 @@ type Link = {
|
||||
|
||||
// This structure doesn't exactly correspond to the data model.
|
||||
// Instead, it maps to how the UI is organized, and how we present a post.
|
||||
type EmbedDraft = {
|
||||
export type EmbedDraft = {
|
||||
// We'll always submit quote and actual media (images, video, gifs) chosen by the user.
|
||||
quote: Link | undefined
|
||||
media: ImagesMedia | VideoMedia | GifMedia | undefined
|
||||
@@ -304,9 +308,13 @@ export function createComposerState({
|
||||
}
|
||||
let quote: Link | undefined
|
||||
if (initQuoteUri) {
|
||||
quote = {
|
||||
type: 'link',
|
||||
uri: initQuoteUri,
|
||||
// TODO: Consider passing the app url directly.
|
||||
const path = postUriToRelativePath(initQuoteUri)
|
||||
if (path) {
|
||||
quote = {
|
||||
type: 'link',
|
||||
uri: toBskyAppUrl(path),
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Other initial content.
|
||||
|
||||
Reference in New Issue
Block a user