Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <pfrazee@gmail.com>

authored by

Hailey
Paul Frazee
and committed by
GitHub
97750c4a 08462375

+67 -43
+1 -1
package.json
··· 51 51 }, 52 52 "dependencies": { 53 53 "@atproto-labs/api": "^0.12.8-clipclops.0", 54 - "@atproto/api": "^0.12.6", 54 + "@atproto/api": "^0.12.9", 55 55 "@bam.tech/react-native-image-resizer": "^3.0.4", 56 56 "@braintree/sanitize-url": "^6.0.2", 57 57 "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
+1 -3
src/components/moderation/LabelsOnMe.tsx
··· 32 32 if (!labels || !currentAccount) { 33 33 return null 34 34 } 35 - labels = labels.filter( 36 - l => !l.val.startsWith('!') && l.src !== currentAccount.did, 37 - ) 35 + labels = labels.filter(l => !l.val.startsWith('!')) 38 36 if (!labels.length) { 39 37 return null 40 38 }
+61 -35
src/components/moderation/LabelsOnMeDialog.tsx
··· 7 7 import {useLabelInfo} from '#/lib/moderation/useLabelInfo' 8 8 import {makeProfileLink} from '#/lib/routes/links' 9 9 import {sanitizeHandle} from '#/lib/strings/handles' 10 - import {useAgent} from '#/state/session' 10 + import {useAgent, useSession} from '#/state/session' 11 11 import * as Toast from '#/view/com/util/Toast' 12 12 import {atoms as a, useBreakpoints, useTheme} from '#/alf' 13 13 import {Button, ButtonText} from '#/components/Button' ··· 33 33 labels: ComAtprotoLabelDefs.Label[] 34 34 } 35 35 36 - export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { 36 + export function LabelsOnMeDialog(props: LabelsOnMeDialogProps) { 37 + return ( 38 + <Dialog.Outer control={props.control}> 39 + <Dialog.Handle /> 40 + 41 + <LabelsOnMeDialogInner {...props} /> 42 + </Dialog.Outer> 43 + ) 44 + } 45 + 46 + function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { 37 47 const {_} = useLingui() 48 + const {currentAccount} = useSession() 38 49 const [appealingLabel, setAppealingLabel] = React.useState< 39 50 ComAtprotoLabelDefs.Label | undefined 40 51 >(undefined) 41 52 const {subject, labels} = props 42 53 const isAccount = 'did' in subject 54 + const containsSelfLabel = React.useMemo( 55 + () => labels.some(l => l.src === currentAccount?.did), 56 + [currentAccount?.did, labels], 57 + ) 43 58 44 59 return ( 45 60 <Dialog.ScrollableInner ··· 65 80 )} 66 81 </Text> 67 82 <Text style={[a.text_md, a.leading_snug]}> 68 - <Trans> 69 - You may appeal these labels if you feel they were placed in error. 70 - </Trans> 83 + {containsSelfLabel ? ( 84 + <Trans> 85 + You may appeal non-self labels if you feel they were placed in 86 + error. 87 + </Trans> 88 + ) : ( 89 + <Trans> 90 + You may appeal these labels if you feel they were placed in 91 + error. 92 + </Trans> 93 + )} 71 94 </Text> 72 95 73 96 <View style={[a.py_lg, a.gap_md]}> ··· 75 98 <Label 76 99 key={`${label.val}-${label.src}`} 77 100 label={label} 101 + isSelfLabel={label.src === currentAccount?.did} 78 102 control={props.control} 79 103 onPressAppeal={label => setAppealingLabel(label)} 80 104 /> ··· 88 112 ) 89 113 } 90 114 91 - export function LabelsOnMeDialog(props: LabelsOnMeDialogProps) { 92 - return ( 93 - <Dialog.Outer control={props.control}> 94 - <Dialog.Handle /> 95 - 96 - <LabelsOnMeDialogInner {...props} /> 97 - </Dialog.Outer> 98 - ) 99 - } 100 - 101 115 function Label({ 102 116 label, 117 + isSelfLabel, 103 118 control, 104 119 onPressAppeal, 105 120 }: { 106 121 label: ComAtprotoLabelDefs.Label 122 + isSelfLabel: boolean 107 123 control: Dialog.DialogOuterProps['control'] 108 124 onPressAppeal: (label: ComAtprotoLabelDefs.Label) => void 109 125 }) { ··· 125 141 {strings.description} 126 142 </Text> 127 143 </View> 128 - <View> 129 - <Button 130 - variant="solid" 131 - color="secondary" 132 - size="small" 133 - label={_(msg`Appeal`)} 134 - onPress={() => onPressAppeal(label)}> 135 - <ButtonText> 136 - <Trans>Appeal</Trans> 137 - </ButtonText> 138 - </Button> 139 - </View> 144 + {!isSelfLabel && ( 145 + <View> 146 + <Button 147 + variant="solid" 148 + color="secondary" 149 + size="small" 150 + label={_(msg`Appeal`)} 151 + onPress={() => onPressAppeal(label)}> 152 + <ButtonText> 153 + <Trans>Appeal</Trans> 154 + </ButtonText> 155 + </Button> 156 + </View> 157 + )} 140 158 </View> 141 159 142 160 <Divider /> 143 161 144 162 <View style={[a.px_md, a.py_sm, t.atoms.bg_contrast_25]}> 145 163 <Text style={[t.atoms.text_contrast_medium]}> 146 - <Trans>Source:</Trans>{' '} 147 - <InlineLinkText 148 - to={makeProfileLink( 149 - labeler ? labeler.creator : {did: label.src, handle: ''}, 150 - )} 151 - onPress={() => control.close()}> 152 - {labeler ? sanitizeHandle(labeler.creator.handle, '@') : label.src} 153 - </InlineLinkText> 164 + {isSelfLabel ? ( 165 + <Trans>This label was applied by you</Trans> 166 + ) : ( 167 + <> 168 + <Trans>Source:</Trans>{' '} 169 + <InlineLinkText 170 + to={makeProfileLink( 171 + labeler ? labeler.creator : {did: label.src, handle: ''}, 172 + )} 173 + onPress={() => control.close()}> 174 + {labeler 175 + ? sanitizeHandle(labeler.creator.handle, '@') 176 + : label.src} 177 + </InlineLinkText> 178 + </> 179 + )} 154 180 </Text> 155 181 </View> 156 182 </View>
+4 -4
yarn.lock
··· 58 58 multiformats "^9.9.0" 59 59 tlds "^1.234.0" 60 60 61 - "@atproto/api@^0.12.6": 62 - version "0.12.6" 63 - resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.12.6.tgz#690c004c5ac7fc7bceac4605d8c1ec1f580be270" 64 - integrity sha512-30htXN2Hjl1jzzeAtIhggOsVS4vA975pMUQYoA4xMonug+z6O9NHcka3yYb4C9ldpnGugvRPKH7EhAUbiDTC5w== 61 + "@atproto/api@^0.12.9": 62 + version "0.12.9" 63 + resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.12.9.tgz#5ae040980e574a5d9496368c4ca032c0cda174ec" 64 + integrity sha512-3D4n2ZAAsDRnjevvcoIxQxuMMoqc+7vtVyP7EnrEdeOmRSCF9j8yXTqhn6rcHCbzcs3DKyYR26nQemtZsMsE0g== 65 65 dependencies: 66 66 "@atproto/common-web" "^0.3.0" 67 67 "@atproto/lexicon" "^0.4.0"