about summary refs log tree commit diff
path: root/src/view/com/composer/state/composer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/com/composer/state/composer.ts')
-rw-r--r--src/view/com/composer/state/composer.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/view/com/composer/state/composer.ts b/src/view/com/composer/state/composer.ts
index 769a0521d..62d1bff49 100644
--- a/src/view/com/composer/state/composer.ts
+++ b/src/view/com/composer/state/composer.ts
@@ -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.