From 2f75e29991beeb4161ca870b5985837882710001 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Thu, 6 Jun 2024 23:22:33 +0200 Subject: [PATCH] DMARC modal: fix inserts of detailed and aggregated reports' emails. --- src/App/Page/Zone.purs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/App/Page/Zone.purs b/src/App/Page/Zone.purs index 10d68cb..8e3c6cb 100644 --- a/src/App/Page/Zone.purs +++ b/src/App/Page/Zone.purs @@ -897,29 +897,19 @@ handleAction = case _ of DMARC_remove_rua i -> do state <- H.get - let current_ruas = case state._currentRR.dmarc of - Nothing -> [] - Just dmarc -> fromMaybe [] dmarc.rua + let current_ruas = fromMaybe [] state.dmarc.rua new_value = case (remove_id i $ attach_id 0 current_ruas) of [] -> Nothing v -> Just v - new_dmarc = case state._currentRR.dmarc of - Nothing -> DMARC.emptyDMARCRR { rua = new_value } - Just dmarc -> dmarc { rua = new_value } - H.modify_ \s -> s { _currentRR { dmarc = Just new_dmarc } } + H.modify_ \s -> s { dmarc { rua = new_value } } DMARC_remove_ruf i -> do state <- H.get - let current_rufs = case state._currentRR.dmarc of - Nothing -> [] - Just dmarc -> fromMaybe [] dmarc.ruf + let current_rufs = fromMaybe [] state.dmarc.ruf new_value = case (remove_id i $ attach_id 0 current_rufs) of [] -> Nothing v -> Just v - new_dmarc = case state._currentRR.dmarc of - Nothing -> DMARC.emptyDMARCRR { ruf = new_value } - Just dmarc -> dmarc { ruf = new_value } - H.modify_ \s -> s { _currentRR { dmarc = Just new_dmarc } } + H.modify_ \s -> s { dmarc { ruf = new_value } } DMARC_policy v -> H.modify_ _ { dmarc { p = fromMaybe DMARC.None $ DMARC.policies A.!! v } } DMARC_sp_policy v -> H.modify_ _ { dmarc { sp = DMARC.policies A.!! (v - 1) } }