) {
const { i18n } = window;
const title = i18n('clearAllConfirmationTitle');
const message = i18n('clearAllConfirmationBody');
const onClose = dispatch(updateConfirmModal(null));
dispatch(
updateConfirmModal({
title,
message,
onClose,
onClickOk: async () => {
window?.log?.info('Blocking all conversations');
if (!convoRequests) {
window?.log?.info('No conversation requests to block.');
return;
}
let newConvosBlocked = [];
const convoController = getConversationController();
await Promise.all(
(newConvosBlocked = convoRequests.filter(async convo => {
const { id } = convo;
const convoModel = convoController.get(id);
if (!convoModel.isBlocked()) {
await BlockedNumberController.block(id);
await convoModel.commit();
}
await convoModel.setIsApproved(false);
// if we're looking at the convo to decline, close the convo
if (selectedConversation?.id === id) {
dispatch(resetConversationExternal());
}
return true;
}))
);
if (newConvosBlocked) {
await forceSyncConfigurationNowIfNeeded();
}
// if no more requests, return to placeholder screen
if (convoRequestCount === newConvosBlocked.length) {
dispatch(resetOverlayMode());
dispatch(showLeftPaneSection(SectionType.Message));
dispatch(resetConversationExternal());
}
},
})
);
}
return (
{convoRequestCount ? (
<>
{
handleClearAllRequestsClick(messageRequests);
}}
/>
>
) : (
<>
{window.i18n('noMessageRequestsPending')}
>
)}
);
};