fix did type problems
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
ModerationCause,
|
||||
ModerationUI,
|
||||
InterpretedLabelValueDefinition,
|
||||
LABELS,
|
||||
AppBskyLabelerDefs,
|
||||
BskyAgent,
|
||||
Did,
|
||||
InterpretedLabelValueDefinition,
|
||||
LABELS,
|
||||
ModerationCause,
|
||||
ModerationOpts,
|
||||
ModerationUI,
|
||||
} from '@atproto/api'
|
||||
|
||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||
@@ -60,10 +61,9 @@ export function isAppLabeler(
|
||||
| AppBskyLabelerDefs.LabelerView
|
||||
| AppBskyLabelerDefs.LabelerViewDetailed,
|
||||
): boolean {
|
||||
if (typeof labeler === 'string') {
|
||||
return BskyAgent.appLabelers.includes(labeler)
|
||||
}
|
||||
return BskyAgent.appLabelers.includes(labeler.creator.did)
|
||||
const did = typeof labeler === 'string' ? labeler : labeler.creator.did
|
||||
// assertion here that `did` starts with `did:`
|
||||
return did.startsWith('did:') && BskyAgent.appLabelers.includes(did as Did)
|
||||
}
|
||||
|
||||
export function isLabelerSubscribed(
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
DEFAULT_LABEL_SETTINGS,
|
||||
BskyAgent,
|
||||
DEFAULT_LABEL_SETTINGS,
|
||||
Did,
|
||||
interpretLabelValueDefinitions,
|
||||
} from '@atproto/api'
|
||||
|
||||
import {usePreferencesQuery} from './index'
|
||||
import {useLabelersDetailedInfoQuery} from '../labeler'
|
||||
import {usePreferencesQuery} from './index'
|
||||
|
||||
/**
|
||||
* More strict than our default settings for logged in users.
|
||||
@@ -21,7 +22,7 @@ export function useMyLabelersQuery() {
|
||||
const dids = Array.from(
|
||||
new Set(
|
||||
BskyAgent.appLabelers.concat(
|
||||
prefs.data?.moderationPrefs.labelers.map(l => l.did) || [],
|
||||
prefs.data?.moderationPrefs.labelers.map(l => l.did as Did) || [],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user