Comment
This commit is contained in:
@@ -5,6 +5,7 @@ import {ThreadgateAllowUISetting} from '#/state/queries/threadgate/types'
|
|||||||
export function threadgateViewToAllowUISetting(
|
export function threadgateViewToAllowUISetting(
|
||||||
threadgateView: AppBskyFeedDefs.ThreadgateView | undefined,
|
threadgateView: AppBskyFeedDefs.ThreadgateView | undefined,
|
||||||
): ThreadgateAllowUISetting[] {
|
): ThreadgateAllowUISetting[] {
|
||||||
|
// Validate the record for clarity, since backwards compat code is a little confusing
|
||||||
const threadgate =
|
const threadgate =
|
||||||
threadgateView && AppBskyFeedThreadgate.isValidRecord(threadgateView.record)
|
threadgateView && AppBskyFeedThreadgate.isValidRecord(threadgateView.record)
|
||||||
? threadgateView.record
|
? threadgateView.record
|
||||||
@@ -37,11 +38,11 @@ export function threadgateRecordToAllowUISetting(
|
|||||||
const settings: ThreadgateAllowUISetting[] = threadgate.allow
|
const settings: ThreadgateAllowUISetting[] = threadgate.allow
|
||||||
.map(allow => {
|
.map(allow => {
|
||||||
let setting: ThreadgateAllowUISetting | undefined
|
let setting: ThreadgateAllowUISetting | undefined
|
||||||
if (AppBskyFeedThreadgate.isValidMentionRule(allow)) {
|
if (AppBskyFeedThreadgate.isMentionRule(allow)) {
|
||||||
setting = {type: 'mention'}
|
setting = {type: 'mention'}
|
||||||
} else if (AppBskyFeedThreadgate.isValidFollowingRule(allow)) {
|
} else if (AppBskyFeedThreadgate.isFollowingRule(allow)) {
|
||||||
setting = {type: 'following'}
|
setting = {type: 'following'}
|
||||||
} else if (AppBskyFeedThreadgate.isValidListRule(allow)) {
|
} else if (AppBskyFeedThreadgate.isListRule(allow)) {
|
||||||
setting = {type: 'list', list: allow.list}
|
setting = {type: 'list', list: allow.list}
|
||||||
}
|
}
|
||||||
return setting
|
return setting
|
||||||
|
|||||||
Reference in New Issue
Block a user