This commit is contained in:
Eric Bailey
2025-01-06 18:20:53 -06:00
parent 36f6cb8ec0
commit 9520fdb246
+4 -3
View File
@@ -5,6 +5,7 @@ import {ThreadgateAllowUISetting} from '#/state/queries/threadgate/types'
export function threadgateViewToAllowUISetting(
threadgateView: AppBskyFeedDefs.ThreadgateView | undefined,
): ThreadgateAllowUISetting[] {
// Validate the record for clarity, since backwards compat code is a little confusing
const threadgate =
threadgateView && AppBskyFeedThreadgate.isValidRecord(threadgateView.record)
? threadgateView.record
@@ -37,11 +38,11 @@ export function threadgateRecordToAllowUISetting(
const settings: ThreadgateAllowUISetting[] = threadgate.allow
.map(allow => {
let setting: ThreadgateAllowUISetting | undefined
if (AppBskyFeedThreadgate.isValidMentionRule(allow)) {
if (AppBskyFeedThreadgate.isMentionRule(allow)) {
setting = {type: 'mention'}
} else if (AppBskyFeedThreadgate.isValidFollowingRule(allow)) {
} else if (AppBskyFeedThreadgate.isFollowingRule(allow)) {
setting = {type: 'following'}
} else if (AppBskyFeedThreadgate.isValidListRule(allow)) {
} else if (AppBskyFeedThreadgate.isListRule(allow)) {
setting = {type: 'list', list: allow.list}
}
return setting