Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Merge pull request #3209 from bluesky-social/samuel/loggedout-warning-2

Add warning about sharing if post author has the !no-unauthenticated label

authored by

Samuel Newman and committed by
GitHub
6279c5cf 1c25c766

+50 -3
+22 -1
src/view/com/profile/ProfileMenu.tsx
··· 58 58 ) 59 59 60 60 const blockPromptControl = Prompt.usePromptControl() 61 + const loggedOutWarningPromptControl = Prompt.usePromptControl() 62 + 63 + const showLoggedOutWarning = React.useMemo(() => { 64 + return !!profile.labels?.find(label => label.val === '!no-unauthenticated') 65 + }, [profile.labels]) 61 66 62 67 const invalidateProfileQuery = React.useCallback(() => { 63 68 queryClient.invalidateQueries({ ··· 192 197 <Menu.Item 193 198 testID="profileHeaderDropdownShareBtn" 194 199 label={_(msg`Share`)} 195 - onPress={onPressShare}> 200 + onPress={() => { 201 + if (showLoggedOutWarning) { 202 + loggedOutWarningPromptControl.open() 203 + } else { 204 + onPressShare() 205 + } 206 + }}> 196 207 <Menu.ItemText> 197 208 <Trans>Share</Trans> 198 209 </Menu.ItemText> ··· 309 320 profile.viewer?.blocking ? _(msg`Unblock`) : _(msg`Block`) 310 321 } 311 322 confirmButtonColor={profile.viewer?.blocking ? undefined : 'negative'} 323 + /> 324 + 325 + <Prompt.Basic 326 + control={loggedOutWarningPromptControl} 327 + title={_(msg`Note about sharing`)} 328 + description={_( 329 + msg`This profile is only visible to logged-in users. It won't be visible to people who aren't logged in.`, 330 + )} 331 + onConfirm={onPressShare} 332 + confirmButtonCta={_(msg`Share anyway`)} 312 333 /> 313 334 </EventStopper> 314 335 )
+28 -2
src/view/com/util/forms/PostDropdownBtn.tsx
··· 85 85 const {mutedWordsDialogControl} = useGlobalDialogsControlContext() 86 86 const deletePromptControl = useDialogControl() 87 87 const hidePromptControl = useDialogControl() 88 + const loggedOutWarningPromptControl = useDialogControl() 88 89 89 90 const rootUri = record.reply?.root?.uri || postUri 90 91 const isThreadMuted = mutedThreads.includes(rootUri) 91 92 const isPostHidden = hiddenPosts && hiddenPosts.includes(postUri) 92 93 const isAuthor = postAuthor.did === currentAccount?.did 94 + 93 95 const href = React.useMemo(() => { 94 96 const urip = new AtUri(postUri) 95 97 return makeProfileLink(postAuthor, 'post', urip.rkey) ··· 167 169 hidePost({uri: postUri}) 168 170 }, [postUri, hidePost]) 169 171 172 + const shouldShowLoggedOutWarning = React.useMemo(() => { 173 + return !!postAuthor.labels?.find( 174 + label => label.val === '!no-unauthenticated', 175 + ) 176 + }, [postAuthor]) 177 + 178 + const onSharePost = React.useCallback(() => { 179 + const url = toShareUrl(href) 180 + shareUrl(url) 181 + }, [href]) 182 + 170 183 return ( 171 184 <EventStopper onKeyDown={false}> 172 185 <Menu.Root> ··· 217 230 testID="postDropdownShareBtn" 218 231 label={isWeb ? _(msg`Copy link to post`) : _(msg`Share`)} 219 232 onPress={() => { 220 - const url = toShareUrl(href) 221 - shareUrl(url) 233 + if (shouldShowLoggedOutWarning) { 234 + loggedOutWarningPromptControl.open() 235 + } else { 236 + onSharePost() 237 + } 222 238 }}> 223 239 <Menu.ItemText> 224 240 {isWeb ? _(msg`Copy link to post`) : _(msg`Share`)} ··· 341 357 description={_(msg`This post will be hidden from feeds.`)} 342 358 onConfirm={onHidePost} 343 359 confirmButtonCta={_(msg`Hide`)} 360 + /> 361 + 362 + <Prompt.Basic 363 + control={loggedOutWarningPromptControl} 364 + title={_(msg`Note about sharing`)} 365 + description={_( 366 + msg`This post is only visible to logged-in users. It won't be visible to people who aren't logged in.`, 367 + )} 368 + onConfirm={onSharePost} 369 + confirmButtonCta={_(msg`Share anyway`)} 344 370 /> 345 371 </EventStopper> 346 372 )