Use asPredicate

This commit is contained in:
Eric Bailey
2025-02-05 11:05:21 -06:00
parent eccbc566c7
commit df5c9be1d2
+3 -2
View File
@@ -1,4 +1,4 @@
import {AppBskyFeedDefs, AppBskyFeedThreadgate} from '@atproto/api'
import {AppBskyFeedDefs, AppBskyFeedThreadgate, asPredicate} from '@atproto/api'
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate/types'
@@ -7,7 +7,8 @@ export function threadgateViewToAllowUISetting(
): ThreadgateAllowUISetting[] {
// Validate the record for clarity, since backwards compat code is a little confusing
const threadgate =
threadgateView && AppBskyFeedThreadgate.isValidRecord(threadgateView.record)
threadgateView &&
asPredicate(AppBskyFeedThreadgate.validateRecord)(threadgateView.record)
? threadgateView.record
: undefined
return threadgateRecordToAllowUISetting(threadgate)