From e8a53dcea84afc3b313037dbaf059c68121eb9ab Mon Sep 17 00:00:00 2001
From: dan <dan.abramov@gmail.com>
Date: Thu, 24 Oct 2024 20:41:50 +0100
Subject: Refactor post meta to return PostView (#5645)

---
 src/view/com/composer/ComposerReplyTo.tsx | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

(limited to 'src/view/com/composer/ComposerReplyTo.tsx')

diff --git a/src/view/com/composer/ComposerReplyTo.tsx b/src/view/com/composer/ComposerReplyTo.tsx
index 7f4bb85f2..5bd5abbc8 100644
--- a/src/view/com/composer/ComposerReplyTo.tsx
+++ b/src/view/com/composer/ComposerReplyTo.tsx
@@ -13,7 +13,7 @@ import {useLingui} from '@lingui/react'
 import {sanitizeDisplayName} from '#/lib/strings/display-names'
 import {sanitizeHandle} from '#/lib/strings/handles'
 import {ComposerOptsPostRef} from '#/state/shell/composer'
-import {QuoteEmbed} from '#/view/com/util/post-embeds/QuoteEmbed'
+import {MaybeQuoteEmbed} from '#/view/com/util/post-embeds/QuoteEmbed'
 import {Text} from '#/view/com/util/text/Text'
 import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar'
 import {atoms as a, useTheme} from '#/alf'
@@ -33,33 +33,21 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
     })
   }, [])
 
-  const quote = React.useMemo(() => {
+  const quoteEmbed = React.useMemo(() => {
     if (
       AppBskyEmbedRecord.isView(embed) &&
       AppBskyEmbedRecord.isViewRecord(embed.record) &&
       AppBskyFeedPost.isRecord(embed.record.value)
     ) {
-      // Not going to include the images right now
-      return {
-        author: embed.record.author,
-        cid: embed.record.cid,
-        uri: embed.record.uri,
-        indexedAt: embed.record.indexedAt,
-        text: embed.record.value.text,
-      }
+      return embed
     } else if (
       AppBskyEmbedRecordWithMedia.isView(embed) &&
       AppBskyEmbedRecord.isViewRecord(embed.record.record) &&
       AppBskyFeedPost.isRecord(embed.record.record.value)
     ) {
-      return {
-        author: embed.record.record.author,
-        cid: embed.record.record.cid,
-        uri: embed.record.record.uri,
-        indexedAt: embed.record.record.indexedAt,
-        text: embed.record.record.value.text,
-      }
+      return embed.record
     }
+    return null
   }, [embed])
 
   const images = React.useMemo(() => {
@@ -110,7 +98,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) {
             <ComposerReplyToImages images={images} showFull={showFull} />
           )}
         </View>
-        {showFull && quote && <QuoteEmbed quote={quote} />}
+        {showFull && quoteEmbed && <MaybeQuoteEmbed embed={quoteEmbed} />}
       </View>
     </Pressable>
   )
-- 
cgit 1.4.1

