Use asPredicate

This commit is contained in:
Eric Bailey
2025-02-05 11:03:07 -06:00
parent 3ed20f1050
commit f6b21057b9
+9 -3
View File
@@ -4,6 +4,7 @@ import {
AppBskyEmbedRecordWithMedia, AppBskyEmbedRecordWithMedia,
AppBskyFeedDefs, AppBskyFeedDefs,
AppBskyFeedPost, AppBskyFeedPost,
asPredicate,
} from '@atproto/api' } from '@atproto/api'
import {isPostInLanguage} from '../../locale/helpers' import {isPostInLanguage} from '../../locale/helpers'
@@ -65,7 +66,10 @@ export class FeedViewPostsSlice {
this.isFallbackMarker = true this.isFallbackMarker = true
return return
} }
if (!AppBskyFeedPost.isValidRecord(post.record)) { if (
!AppBskyFeedPost.isRecord(post.record) ||
!asPredicate(AppBskyFeedPost.validateRecord)(post.record)
) {
return return
} }
const parent = reply?.parent const parent = reply?.parent
@@ -95,7 +99,8 @@ export class FeedViewPostsSlice {
} }
if ( if (
!AppBskyFeedDefs.isPostView(parent) || !AppBskyFeedDefs.isPostView(parent) ||
!AppBskyFeedPost.isValidRecord(parent.record) !AppBskyFeedPost.isRecord(parent.record) ||
!asPredicate(AppBskyFeedPost.validateRecord)(parent.record)
) { ) {
this.isOrphan = true this.isOrphan = true
return return
@@ -136,7 +141,8 @@ export class FeedViewPostsSlice {
} }
if ( if (
!AppBskyFeedDefs.isPostView(root) || !AppBskyFeedDefs.isPostView(root) ||
!AppBskyFeedPost.isValidRecord(root.record) !AppBskyFeedPost.isRecord(root.record) ||
!asPredicate(AppBskyFeedPost.validateRecord)(root.record)
) { ) {
this.isOrphan = true this.isOrphan = true
return return