Confirm before detaching post

This commit is contained in:
Eric Bailey
2024-08-13 15:43:56 -05:00
parent 75b804fed9
commit 61519a0beb
+16 -1
View File
@@ -119,6 +119,7 @@ let PostDropdownBtn = ({
const embedPostControl = useDialogControl()
const sendViaChatControl = useDialogControl()
const postInteractionSettingsDialogControl = useDialogControl()
const quotePostDetachConfirmControl = useDialogControl()
const {mutateAsync: toggleReplyVisibility} =
useToggleReplyVisibilityMutation()
@@ -526,7 +527,11 @@ let PostDropdownBtn = ({
? _(msg`Re-attach quote`)
: _(msg`Detach quote`)
}
onPress={onToggleQuotePostAttachment}>
onPress={
quoteEmbed.isDetached
? onToggleQuotePostAttachment
: () => quotePostDetachConfirmControl.open()
}>
<Menu.ItemText>
{quoteEmbed.isDetached
? _(msg`Re-attach quote`)
@@ -658,6 +663,16 @@ let PostDropdownBtn = ({
rootPostUri={rootUri}
initialThreadgateView={post.threadgate}
/>
<Prompt.Basic
control={quotePostDetachConfirmControl}
title={_(msg`Detach quote post?`)}
description={_(
msg`This will remove your post from this quote post for all users, and replace it with a placeholder.`,
)}
onConfirm={onToggleQuotePostAttachment}
confirmButtonCta={_(msg`Yes, detach`)}
/>
</EventStopper>
)
}