Update to use new SDK appLabelers semantics

This commit is contained in:
Paul Frazee
2024-03-12 11:43:15 -07:00
parent 02f949781a
commit cad66269d3
4 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -54,16 +54,16 @@ export function lookupLabelValueDefinition(
return def
}
export function isModAuthority(
export function isAppLabeler(
labeler:
| string
| AppBskyLabelerDefs.LabelerView
| AppBskyLabelerDefs.LabelerViewDetailed,
): boolean {
if (typeof labeler === 'string') {
return BskyAgent.modAuthoritiesHeader.includes(labeler)
return BskyAgent.appLabelers.includes(labeler)
}
return BskyAgent.modAuthoritiesHeader.includes(labeler.creator.did)
return BskyAgent.appLabelers.includes(labeler.creator.did)
}
export function isLabelerSubscribed(
@@ -74,7 +74,7 @@ export function isLabelerSubscribed(
modOpts: ModerationOpts,
) {
labeler = typeof labeler === 'string' ? labeler : labeler.creator.did
if (isModAuthority(labeler)) {
if (isAppLabeler(labeler)) {
return true
}
return modOpts.prefs.labelers.find(l => l.did === labeler)
@@ -22,7 +22,7 @@ import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
import {logger} from '#/logger'
import {Haptics} from '#/lib/haptics'
import {pluralize} from '#/lib/strings/helpers'
import {isModAuthority} from '#/lib/moderation'
import {isAppLabeler} from '#/lib/moderation'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
@@ -174,7 +174,7 @@ let ProfileHeaderLabeler = ({
<Trans>Edit Profile</Trans>
</ButtonText>
</Button>
) : !isModAuthority(profile.did) ? (
) : !isAppLabeler(profile.did) ? (
<>
<Button
testID="toggleSubscribeBtn"
@@ -219,7 +219,7 @@ let ProfileHeaderLabeler = ({
/>
</View>
) : undefined}
{!isModAuthority(profile.did) && (
{!isAppLabeler(profile.did) && (
<View style={[a.flex_row, a.gap_xs, a.align_center, a.pt_lg]}>
<Button
testID="toggleLikeBtn"
+1 -1
View File
@@ -19,7 +19,7 @@ export function useMyLabelers() {
const prefs = usePreferencesQuery()
const dids = Array.from(
new Set(
BskyAgent.modAuthoritiesHeader.concat(
BskyAgent.appLabelers.concat(
prefs.data?.moderationPrefs.labelers.map(l => l.did) || [],
),
),
+2 -2
View File
@@ -664,9 +664,9 @@ async function configureModeration(agent: BskyAgent, account: SessionAccount) {
console.warn('USING TEST ENV MODERATION')
const did = (await agent.resolveHandle({handle: 'mod-authority.test'})).data
.did
BskyAgent.configure({modAuthorities: [did]})
BskyAgent.configure({appLabelers: [did]})
} else {
BskyAgent.configure({modAuthorities: [BSKY_LABELER_DID]})
BskyAgent.configure({appLabelers: [BSKY_LABELER_DID]})
}
}