add warning to profile as well
parent
7bdaa624b7
commit
78a836d2b1
|
@ -58,6 +58,11 @@ let ProfileMenu = ({
|
||||||
)
|
)
|
||||||
|
|
||||||
const blockPromptControl = Prompt.usePromptControl()
|
const blockPromptControl = Prompt.usePromptControl()
|
||||||
|
const loggedOutWarningPromptControl = Prompt.usePromptControl()
|
||||||
|
|
||||||
|
const showLoggedOutWarning = React.useMemo(() => {
|
||||||
|
return !!profile.labels?.find(label => label.val === '!no-unauthenticated')
|
||||||
|
}, [profile.labels])
|
||||||
|
|
||||||
const invalidateProfileQuery = React.useCallback(() => {
|
const invalidateProfileQuery = React.useCallback(() => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
|
@ -192,7 +197,13 @@ let ProfileMenu = ({
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
testID="profileHeaderDropdownShareBtn"
|
testID="profileHeaderDropdownShareBtn"
|
||||||
label={_(msg`Share`)}
|
label={_(msg`Share`)}
|
||||||
onPress={onPressShare}>
|
onPress={() => {
|
||||||
|
if (showLoggedOutWarning) {
|
||||||
|
loggedOutWarningPromptControl.open()
|
||||||
|
} else {
|
||||||
|
onPressShare()
|
||||||
|
}
|
||||||
|
}}>
|
||||||
<Menu.ItemText>
|
<Menu.ItemText>
|
||||||
<Trans>Share</Trans>
|
<Trans>Share</Trans>
|
||||||
</Menu.ItemText>
|
</Menu.ItemText>
|
||||||
|
@ -310,6 +321,16 @@ let ProfileMenu = ({
|
||||||
}
|
}
|
||||||
confirmButtonColor={profile.viewer?.blocking ? undefined : 'negative'}
|
confirmButtonColor={profile.viewer?.blocking ? undefined : 'negative'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Prompt.Basic
|
||||||
|
control={loggedOutWarningPromptControl}
|
||||||
|
title={_(msg`Note about sharing`)}
|
||||||
|
description={_(
|
||||||
|
msg`This profile is only visible to logged-in users. It won't be visible to people who aren't logged in.`,
|
||||||
|
)}
|
||||||
|
onConfirm={onPressShare}
|
||||||
|
confirmButtonCta={_(msg`Share anyway`)}
|
||||||
|
/>
|
||||||
</EventStopper>
|
</EventStopper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue