Use asPredicate
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user