From 97750c4aabbcf221561d1d373cb2238627411be2 Mon Sep 17 00:00:00 2001 From: Hailey Date: Sat, 11 May 2024 15:07:50 -0700 Subject: Show "label has been placed..." even for self-labels (#3874) * show labels placed on your content even if it's a self-label even friendlier wording friendlier wording remove unnecessary `export` temp revert reordering show labels placed on your content even if it's a self-label * Bump api 0.12.9 --------- Co-authored-by: Paul Frazee --- src/components/moderation/LabelsOnMeDialog.tsx | 96 ++++++++++++++++---------- 1 file changed, 61 insertions(+), 35 deletions(-) (limited to 'src/components/moderation/LabelsOnMeDialog.tsx') diff --git a/src/components/moderation/LabelsOnMeDialog.tsx b/src/components/moderation/LabelsOnMeDialog.tsx index 176b04941..858ac9ce4 100644 --- a/src/components/moderation/LabelsOnMeDialog.tsx +++ b/src/components/moderation/LabelsOnMeDialog.tsx @@ -7,7 +7,7 @@ import {useLingui} from '@lingui/react' import {useLabelInfo} from '#/lib/moderation/useLabelInfo' import {makeProfileLink} from '#/lib/routes/links' import {sanitizeHandle} from '#/lib/strings/handles' -import {useAgent} from '#/state/session' +import {useAgent, useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' @@ -33,13 +33,28 @@ export interface LabelsOnMeDialogProps { labels: ComAtprotoLabelDefs.Label[] } -export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { +export function LabelsOnMeDialog(props: LabelsOnMeDialogProps) { + return ( + + + + + + ) +} + +function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { const {_} = useLingui() + const {currentAccount} = useSession() const [appealingLabel, setAppealingLabel] = React.useState< ComAtprotoLabelDefs.Label | undefined >(undefined) const {subject, labels} = props const isAccount = 'did' in subject + const containsSelfLabel = React.useMemo( + () => labels.some(l => l.src === currentAccount?.did), + [currentAccount?.did, labels], + ) return ( - - You may appeal these labels if you feel they were placed in error. - + {containsSelfLabel ? ( + + You may appeal non-self labels if you feel they were placed in + error. + + ) : ( + + You may appeal these labels if you feel they were placed in + error. + + )} @@ -75,6 +98,7 @@ export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { - - - + {!isSelfLabel && ( + + + + )} - Source:{' '} - control.close()}> - {labeler ? sanitizeHandle(labeler.creator.handle, '@') : label.src} - + {isSelfLabel ? ( + This label was applied by you + ) : ( + <> + Source:{' '} + control.close()}> + {labeler + ? sanitizeHandle(labeler.creator.handle, '@') + : label.src} + + + )} -- cgit 1.4.1