Fix notification descriptions and render images for your own posts in notifs

This commit is contained in:
Paul Frazee 2023-01-17 12:12:17 -06:00
parent b9778b7943
commit ee8d311795
3 changed files with 63 additions and 13 deletions

View file

@ -11,6 +11,7 @@ import {ago, pluralize} from '../../../lib/strings'
import {UpIconSolid} from '../../lib/icons'
import {Text} from '../util/text/Text'
import {UserAvatar} from '../util/UserAvatar'
import {ImageHorzList} from '../util/images/ImageHorzList'
import {ErrorMessage} from '../util/error/ErrorMessage'
import {Post} from '../post/Post'
import {Link} from '../util/Link'
@ -181,6 +182,7 @@ export const FeedItem = observer(function FeedItem({
</Text>
</>
) : undefined}
<Text style={[styles.metaItem, pal.text]}>{action}</Text>
<Text style={[styles.metaItem, pal.textLight]}>
{ago(item.indexedAt)}
</Text>
@ -208,17 +210,21 @@ function AdditionalPostText({
if (additionalPost.error) {
return <ErrorMessage message={additionalPost.error} />
}
const record = additionalPost.thread?.postRecord
let text = record.text
if (
AppBskyEmbedImages.isMain(record.embed) &&
AppBskyEmbedImages.validateMain(record.embed).success
) {
for (let i = 0; i < record.embed.images.length; i++) {
text += ` [${record.embed.images[i].alt || `image${i + 1}`}]`
}
}
return <Text style={pal.textLight}>{text}</Text>
const text = additionalPost.thread?.postRecord.text
const images = (
additionalPost.thread.post.embed as AppBskyEmbedImages.Presented
)?.images
return (
<>
{text?.length > 0 && <Text style={pal.textLight}>{text}</Text>}
{images && images?.length > 0 && (
<ImageHorzList
uris={images?.map(img => img.thumb)}
style={styles.additionalPostImages}
/>
)}
</>
)
}
const styles = StyleSheet.create({
@ -264,6 +270,11 @@ const styles = StyleSheet.create({
paddingBottom: 5,
color: colors.black,
},
additionalPostImages: {
marginTop: 5,
marginLeft: 2,
opacity: 0.8,
},
addedContainer: {
paddingTop: 4,