Include hydrated responses for other records (#5646)
* Include hydrated responses for other records * Rename meta -> view This is actually all it is now.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import React from 'react'
|
||||
import {StyleProp, View, ViewStyle} from 'react-native'
|
||||
import {AppBskyGraphStarterpack} from '@atproto/api'
|
||||
|
||||
import {ResolvedLink} from '#/lib/api/resolve'
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
import {
|
||||
useResolveGifQuery,
|
||||
@@ -75,12 +77,7 @@ export const ExternalEmbedLink = ({
|
||||
const linkInfo = React.useMemo(
|
||||
() =>
|
||||
data && {
|
||||
title:
|
||||
data.type === 'external'
|
||||
? data.title
|
||||
: data.kind === 'other'
|
||||
? data.meta.title
|
||||
: uri,
|
||||
title: getExternalLinkTitle(data) ?? uri,
|
||||
uri,
|
||||
description: data.type === 'external' ? data.description : '',
|
||||
thumb: data.type === 'external' ? data.thumb?.source.path : undefined,
|
||||
@@ -137,3 +134,22 @@ function Container({
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function getExternalLinkTitle(link: ResolvedLink): string | undefined {
|
||||
if (link.type === 'external') {
|
||||
return link.title
|
||||
}
|
||||
switch (link.kind) {
|
||||
// These are currently treated as external.
|
||||
// TODO: Display them as embeds instead.
|
||||
case 'feed':
|
||||
return link.view.displayName
|
||||
case 'list':
|
||||
return link.view.name
|
||||
case 'starter-pack':
|
||||
const record = link.view.record
|
||||
return AppBskyGraphStarterpack.isRecord(record)
|
||||
? record.name
|
||||
: 'Starter Pack'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ export function LazyQuoteEmbed({uri}: {uri: string}) {
|
||||
if (!data || data.type !== 'record' || data.kind !== 'post') {
|
||||
return null
|
||||
}
|
||||
return <QuoteEmbed quote={data.meta} />
|
||||
return <QuoteEmbed quote={data.view} />
|
||||
}
|
||||
|
||||
function viewRecordToPostView(
|
||||
|
||||
Reference in New Issue
Block a user