Only open block or delete dialog if submitted successfully
This commit is contained in:
@@ -123,7 +123,7 @@ let ConvoMenu = ({
|
|||||||
message: latestReportableMessage,
|
message: latestReportableMessage,
|
||||||
}}
|
}}
|
||||||
control={reportControl}
|
control={reportControl}
|
||||||
onClose={() => {
|
onAfterSubmit={() => {
|
||||||
blockOrDeleteControl.open()
|
blockOrDeleteControl.open()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ export let MessageContextMenu = ({
|
|||||||
convoId: convo.convo.id,
|
convoId: convo.convo.id,
|
||||||
message,
|
message,
|
||||||
}}
|
}}
|
||||||
onClose={() => {
|
onAfterSubmit={() => {
|
||||||
blockOrDeleteControl.open()
|
blockOrDeleteControl.open()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ export function ReportDialog(
|
|||||||
)
|
)
|
||||||
const onClose = React.useCallback(() => {
|
const onClose = React.useCallback(() => {
|
||||||
logger.metric('reportDialog:close', {}, {statsig: false})
|
logger.metric('reportDialog:close', {}, {statsig: false})
|
||||||
props.onClose?.()
|
}, [])
|
||||||
}, [props])
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Outer control={props.control} onClose={onClose}>
|
<Dialog.Outer control={props.control} onClose={onClose}>
|
||||||
<Dialog.Handle />
|
<Dialog.Handle />
|
||||||
@@ -191,7 +190,9 @@ function Inner(props: ReportDialogProps) {
|
|||||||
)
|
)
|
||||||
// give time for user feedback
|
// give time for user feedback
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
props.control.close()
|
props.control.close(() => {
|
||||||
|
props.onAfterSubmit?.()
|
||||||
|
})
|
||||||
}, 1e3)
|
}, 1e3)
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.metric('reportDialog:failure', {}, {statsig: false})
|
logger.metric('reportDialog:failure', {}, {statsig: false})
|
||||||
|
|||||||
@@ -68,5 +68,8 @@ export type ParsedReportSubject =
|
|||||||
export type ReportDialogProps = {
|
export type ReportDialogProps = {
|
||||||
control: Dialog.DialogOuterProps['control']
|
control: Dialog.DialogOuterProps['control']
|
||||||
subject: ParsedReportSubject
|
subject: ParsedReportSubject
|
||||||
onClose?: () => void
|
/**
|
||||||
|
* Called if the report was successfully submitted.
|
||||||
|
*/
|
||||||
|
onAfterSubmit?: () => void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export function RejectMenu({
|
|||||||
message: lastMessage,
|
message: lastMessage,
|
||||||
}}
|
}}
|
||||||
control={reportControl}
|
control={reportControl}
|
||||||
onClose={() => {
|
onAfterSubmit={() => {
|
||||||
blockOrDeleteControl.open()
|
blockOrDeleteControl.open()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user