Update to use new labeler semantics
This commit is contained in:
@@ -4,7 +4,7 @@ import {useFocusEffect} from '@react-navigation/native'
|
||||
import {ComAtprotoLabelDefs} from '@atproto/api'
|
||||
import {Trans, msg} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {AppBskyModerationDefs} from '@atproto/api'
|
||||
import {AppBskyLabelerDefs} from '@atproto/api'
|
||||
import {useSafeAreaFrame} from 'react-native-safe-area-context'
|
||||
|
||||
import {NativeStackScreenProps, CommonNavigatorParams} from '#/lib/routes/types'
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
usePreferencesQuery,
|
||||
usePreferencesSetAdultContentMutation,
|
||||
} from '#/state/queries/preferences'
|
||||
import {useModServicesDetailedInfoQuery} from '#/state/queries/modservice'
|
||||
import {useLabelersDetailedInfoQuery} from '#/state/queries/labeler'
|
||||
|
||||
import {useTheme, atoms as a, useBreakpoints} from '#/alf'
|
||||
import {Divider} from '#/components/Divider'
|
||||
@@ -85,7 +85,7 @@ export function ModerationScreen(
|
||||
isLoading: isModServicesLoading,
|
||||
data: modservices,
|
||||
error: modservicesError,
|
||||
} = useModServicesDetailedInfoQuery({
|
||||
} = useLabelersDetailedInfoQuery({
|
||||
dids: preferences ? preferences.moderationPrefs.mods.map(m => m.did) : [],
|
||||
})
|
||||
const {gtMobile} = useBreakpoints()
|
||||
@@ -131,7 +131,7 @@ export function ModerationScreenInner({
|
||||
modservices,
|
||||
}: {
|
||||
preferences: UsePreferencesQueryResponse
|
||||
modservices: AppBskyModerationDefs.ModServiceViewDetailed[]
|
||||
modservices: AppBskyLabelerDefs.LabelerViewDetailed[]
|
||||
}) {
|
||||
const t = useTheme()
|
||||
const setMinimalShellMode = useSetMinimalShellMode()
|
||||
|
||||
@@ -154,7 +154,7 @@ export function ProfileHeaderDropdownBtn({
|
||||
const dropdownItems: DropdownItem[] = React.useMemo(() => {
|
||||
let items: DropdownItem[] = []
|
||||
|
||||
if (hasSession && profile.associated?.modservice) {
|
||||
if (hasSession && profile.associated?.labeler) {
|
||||
items.push({
|
||||
testID: 'profileHeaderDropdownFollowBtn',
|
||||
label: _(msg`Follow Account`),
|
||||
@@ -251,7 +251,7 @@ export function ProfileHeaderDropdownBtn({
|
||||
}, [
|
||||
isMe,
|
||||
hasSession,
|
||||
profile.associated?.modservice,
|
||||
profile.associated?.labeler,
|
||||
profile.viewer?.muted,
|
||||
profile.viewer?.mutedByList,
|
||||
profile.viewer?.blocking,
|
||||
|
||||
@@ -18,9 +18,7 @@ export function ProfileHeaderHandle({
|
||||
const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy
|
||||
return (
|
||||
<View style={[a.flex_row, a.gap_xs, a.align_center]} pointerEvents="none">
|
||||
{profile.viewer?.followedBy &&
|
||||
!blockHide &&
|
||||
!profile.associated?.modservice ? (
|
||||
{profile.viewer?.followedBy && !blockHide ? (
|
||||
<View style={[t.atoms.bg_contrast_50, a.rounded_xs, a.px_sm, a.py_xs]}>
|
||||
<Text style={[t.atoms.text, a.text_sm]}>
|
||||
<Trans>Follows you</Trans>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, {memo, useMemo} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {
|
||||
AppBskyActorDefs,
|
||||
AppBskyModerationDefs,
|
||||
AppBskyLabelerDefs,
|
||||
ModerationOpts,
|
||||
moderateProfile,
|
||||
RichText as RichTextAPI,
|
||||
@@ -16,7 +16,7 @@ import {useAnalytics} from 'lib/analytics/analytics'
|
||||
import {useSession} from '#/state/session'
|
||||
import {Shadow} from '#/state/cache/types'
|
||||
import {useProfileShadow} from 'state/cache/profile-shadow'
|
||||
import {useModServiceSubscriptionMutation} from '#/state/queries/modservice'
|
||||
import {useLabelerSubscriptionMutation} from '#/state/queries/labeler'
|
||||
import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
|
||||
import {logger} from '#/logger'
|
||||
import {Haptics} from '#/lib/haptics'
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
|
||||
interface Props {
|
||||
profile: AppBskyActorDefs.ProfileViewDetailed
|
||||
modservice: AppBskyModerationDefs.ModServiceViewDetailed
|
||||
modservice: AppBskyLabelerDefs.LabelerViewDetailed
|
||||
descriptionRT: RichTextAPI | null
|
||||
moderationOpts: ModerationOpts
|
||||
hideBackButton?: boolean
|
||||
@@ -66,7 +66,7 @@ let ProfileHeaderModerator = ({
|
||||
)
|
||||
const {data: preferences} = usePreferencesQuery()
|
||||
const {mutateAsync: toggleSubscription, variables} =
|
||||
useModServiceSubscriptionMutation()
|
||||
useLabelerSubscriptionMutation()
|
||||
const isSubscribed =
|
||||
variables?.subscribe ??
|
||||
preferences?.moderationPrefs.mods.find(mod => mod.did === profile.did)
|
||||
|
||||
@@ -113,10 +113,10 @@ let ProfileHeaderShell = ({
|
||||
t.atoms.bg,
|
||||
{borderColor: t.atoms.bg.backgroundColor},
|
||||
styles.avi,
|
||||
profile.associated?.modservice && styles.aviLabeler,
|
||||
profile.associated?.labeler && styles.aviLabeler,
|
||||
]}>
|
||||
<UserAvatar
|
||||
type={profile.associated?.modservice ? 'labeler' : 'user'}
|
||||
type={profile.associated?.labeler ? 'labeler' : 'user'}
|
||||
size={90}
|
||||
avatar={profile.avatar}
|
||||
moderation={moderation.ui('avatar')}
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, {memo} from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {
|
||||
AppBskyActorDefs,
|
||||
AppBskyModerationDefs,
|
||||
AppBskyLabelerDefs,
|
||||
ModerationOpts,
|
||||
RichText as RichTextAPI,
|
||||
} from '@atproto/api'
|
||||
@@ -34,7 +34,7 @@ export {ProfileHeaderLoading}
|
||||
|
||||
interface Props {
|
||||
profile: AppBskyActorDefs.ProfileViewDetailed
|
||||
modservice: AppBskyModerationDefs.ModServiceViewDetailed | undefined
|
||||
modservice: AppBskyLabelerDefs.LabelerViewDetailed | undefined
|
||||
descriptionRT: RichTextAPI | null
|
||||
moderationOpts: ModerationOpts
|
||||
hideBackButton?: boolean
|
||||
@@ -42,7 +42,7 @@ interface Props {
|
||||
}
|
||||
|
||||
let ProfileHeader = (props: Props): React.ReactNode => {
|
||||
if (props.profile.associated?.modservice) {
|
||||
if (props.profile.associated?.labeler) {
|
||||
if (!props.modservice) {
|
||||
return <ProfileHeaderLoading />
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {AppBskyModerationDefs, ModerationOpts} from '@atproto/api'
|
||||
import {AppBskyLabelerDefs, ModerationOpts} from '@atproto/api'
|
||||
import {Trans, msg} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {useSafeAreaFrame} from 'react-native-safe-area-context'
|
||||
|
||||
import {useModServiceSubscriptionMutation} from '#/state/queries/modservice'
|
||||
import {useLabelerSubscriptionMutation} from '#/state/queries/labeler'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
import {useTheme, atoms as a} from '#/alf'
|
||||
@@ -22,7 +22,7 @@ export function ProfileContentFiltersSection({
|
||||
moderationOpts,
|
||||
}: {
|
||||
modServiceQuery: {
|
||||
data: AppBskyModerationDefs.ModServiceViewDetailed | undefined
|
||||
data: AppBskyLabelerDefs.LabelerViewDetailed | undefined
|
||||
isLoading: boolean
|
||||
error: Error | null
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export function ProfileContentFiltersSectionInner({
|
||||
modservice,
|
||||
}: {
|
||||
moderationOpts: ModerationOpts
|
||||
modservice: AppBskyModerationDefs.ModServiceViewDetailed
|
||||
modservice: AppBskyLabelerDefs.LabelerViewDetailed
|
||||
}) {
|
||||
const {_} = useLingui()
|
||||
const t = useTheme()
|
||||
@@ -81,7 +81,7 @@ export function ProfileContentFiltersSectionInner({
|
||||
const hasSession = true // TODO
|
||||
|
||||
const {mutateAsync: toggleSubscription, variables} =
|
||||
useModServiceSubscriptionMutation()
|
||||
useLabelerSubscriptionMutation()
|
||||
const isSubscribed =
|
||||
variables?.subscribe ??
|
||||
moderationOpts.prefs.mods.find(mod => mod.did === modservice.creator.did)
|
||||
|
||||
Reference in New Issue
Block a user