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