DMARC modal: fix inserts of detailed and aggregated reports' emails.

display
Philippe PITTOLI 2024-06-06 23:22:33 +02:00
parent cfd1ecf265
commit 2f75e29991
1 changed files with 4 additions and 14 deletions

View File

@ -897,29 +897,19 @@ handleAction = case _ of
DMARC_remove_rua i -> do DMARC_remove_rua i -> do
state <- H.get state <- H.get
let current_ruas = case state._currentRR.dmarc of let current_ruas = fromMaybe [] state.dmarc.rua
Nothing -> []
Just dmarc -> fromMaybe [] dmarc.rua
new_value = case (remove_id i $ attach_id 0 current_ruas) of new_value = case (remove_id i $ attach_id 0 current_ruas) of
[] -> Nothing [] -> Nothing
v -> Just v v -> Just v
new_dmarc = case state._currentRR.dmarc of H.modify_ \s -> s { dmarc { rua = new_value } }
Nothing -> DMARC.emptyDMARCRR { rua = new_value }
Just dmarc -> dmarc { rua = new_value }
H.modify_ \s -> s { _currentRR { dmarc = Just new_dmarc } }
DMARC_remove_ruf i -> do DMARC_remove_ruf i -> do
state <- H.get state <- H.get
let current_rufs = case state._currentRR.dmarc of let current_rufs = fromMaybe [] state.dmarc.ruf
Nothing -> []
Just dmarc -> fromMaybe [] dmarc.ruf
new_value = case (remove_id i $ attach_id 0 current_rufs) of new_value = case (remove_id i $ attach_id 0 current_rufs) of
[] -> Nothing [] -> Nothing
v -> Just v v -> Just v
new_dmarc = case state._currentRR.dmarc of H.modify_ \s -> s { dmarc { ruf = new_value } }
Nothing -> DMARC.emptyDMARCRR { ruf = new_value }
Just dmarc -> dmarc { ruf = new_value }
H.modify_ \s -> s { _currentRR { dmarc = Just new_dmarc } }
DMARC_policy v -> H.modify_ _ { dmarc { p = fromMaybe DMARC.None $ DMARC.policies A.!! v } } 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) } } DMARC_sp_policy v -> H.modify_ _ { dmarc { sp = DMARC.policies A.!! (v - 1) } }