Use asPredicate
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {AppBskyFeedDefs, AppBskyFeedThreadgate} from '@atproto/api'
|
import {AppBskyFeedDefs, AppBskyFeedThreadgate, asPredicate} from '@atproto/api'
|
||||||
|
|
||||||
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate/types'
|
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate/types'
|
||||||
|
|
||||||
@@ -7,7 +7,8 @@ export function threadgateViewToAllowUISetting(
|
|||||||
): ThreadgateAllowUISetting[] {
|
): ThreadgateAllowUISetting[] {
|
||||||
// Validate the record for clarity, since backwards compat code is a little confusing
|
// Validate the record for clarity, since backwards compat code is a little confusing
|
||||||
const threadgate =
|
const threadgate =
|
||||||
threadgateView && AppBskyFeedThreadgate.isValidRecord(threadgateView.record)
|
threadgateView &&
|
||||||
|
asPredicate(AppBskyFeedThreadgate.validateRecord)(threadgateView.record)
|
||||||
? threadgateView.record
|
? threadgateView.record
|
||||||
: undefined
|
: undefined
|
||||||
return threadgateRecordToAllowUISetting(threadgate)
|
return threadgateRecordToAllowUISetting(threadgate)
|
||||||
|
|||||||
Reference in New Issue
Block a user