diff --git a/src/App/Page/Zone.purs b/src/App/Page/Zone.purs index ac07a6a..d526dbb 100644 --- a/src/App/Page/Zone.purs +++ b/src/App/Page/Zone.purs @@ -267,7 +267,6 @@ type State = , dmarc_mail :: String , dmarc_mail_limit :: Maybe Int - , dmarc_ri :: Maybe Int , dkim :: DKIM.DKIM , dmarc :: DMARC.DMARC @@ -329,7 +328,6 @@ initialState domain = , dmarc_mail: "" , dmarc_mail_limit: Nothing - , dmarc_ri: Nothing , current_tab: Zone } @@ -573,9 +571,9 @@ render state , Bulma.hr , Bulma.div_content [Bulma.explanation Explanations.dmarc_contact] , maybe (Bulma.p "There is no address to send aggregated reports to.") - (display_dmarc_mail_addresses "Addresses to contact for aggregated reports" DMARC_remove_rua) current_ruas + (display_dmarc_mail_addresses "Addresses to contact for aggregated reports" DMARC_remove_rua) state.dmarc.rua , maybe (Bulma.p "There is no address to send detailed reports to.") - (display_dmarc_mail_addresses "Addresses to contact for detailed reports" DMARC_remove_ruf) current_rufs + (display_dmarc_mail_addresses "Addresses to contact for detailed reports" DMARC_remove_ruf) state.dmarc.ruf , Bulma.hr , render_dmarc_mail_errors @@ -587,7 +585,7 @@ render state , Bulma.hr , Bulma.div_content [Bulma.explanation Explanations.dmarc_ri] - , Bulma.box_input "idDMARCri" "Report interval (in seconds)" "86400" DMARC_ri (maybe "0" show state.dmarc_ri) + , Bulma.box_input "idDMARCri" "Report interval (in seconds)" "86400" DMARC_ri (maybe "0" show state.dmarc.ri) ] render_dmarc_mail_errors @@ -595,12 +593,6 @@ render state then Bulma.notification_danger_block' $ [ Bulma.h3 "Invalid mail 😥" ] <> map (Bulma.p <<< show_error_email) state._dmarc_mail_errors else HH.div_ [ ] - current_ruas = case state._currentRR.dmarc of - Nothing -> Nothing - Just dmarc -> dmarc.rua - current_rufs = case state._currentRR.dmarc of - Nothing -> Nothing - Just dmarc -> dmarc.ruf display_domain_side = (if state._currentRR.name == (state._domain <> ".") then "" else "." <> state._domain) newtokenbtn = Bulma.btn (maybe "🏁​ Ask for a token" (\_ -> "🏁​ Ask for a new token") state._currentRR.token) (NewToken state._currentRR.rrid) @@ -776,7 +768,6 @@ handleAction = case _ of , spf_modifier_v = "" , dmarc_mail = "" , dmarc_mail_limit = Nothing - , dmarc_ri = Nothing , _dmarc_mail_errors = [] } @@ -865,22 +856,17 @@ handleAction = case _ of DMARC_mail v -> H.modify_ _ { dmarc_mail = v } DMARC_mail_limit v -> H.modify_ _ { dmarc_mail_limit = Just $ fromMaybe 0 $ fromString v } - DMARC_ri v -> H.modify_ _ { dmarc_ri = fromString v } + DMARC_ri v -> H.modify_ _ { dmarc { ri = fromString v } } DMARC_rua_Add -> do state <- H.get case Email.email state.dmarc_mail of Left errors -> H.modify_ _ { _dmarc_mail_errors = errors } Right _ -> do - let current_ruas = case state._currentRR.dmarc of - Nothing -> [] - Just dmarc -> fromMaybe [] dmarc.rua + let current_ruas = fromMaybe [] state.dmarc.rua dmarc_mail = state.dmarc_mail dmarc_mail_limit = state.dmarc_mail_limit new_list = current_ruas <> [ {mail: dmarc_mail, limit: dmarc_mail_limit} ] - new_dmarc = case state._currentRR.dmarc of - Nothing -> DMARC.emptyDMARCRR { rua = Just new_list } - Just dmarc -> dmarc { rua = Just new_list } - H.modify_ _ { _currentRR { dmarc = Just new_dmarc } } + H.modify_ _ { dmarc { rua = Just new_list }} handleAction $ ResetTemporaryValues DMARC_ruf_Add -> do @@ -888,16 +874,11 @@ handleAction = case _ of case Email.email state.dmarc_mail of Left errors -> H.modify_ _ { _dmarc_mail_errors = errors } Right _ -> do - let current_rufs = case state._currentRR.dmarc of - Nothing -> [] - Just dmarc -> fromMaybe [] dmarc.ruf + let current_rufs = fromMaybe [] state.dmarc.ruf dmarc_mail = state.dmarc_mail dmarc_mail_limit = state.dmarc_mail_limit new_list = current_rufs <> [ {mail: dmarc_mail, limit: dmarc_mail_limit} ] - new_dmarc = case state._currentRR.dmarc of - Nothing -> DMARC.emptyDMARCRR { ruf = Just new_list } - Just dmarc -> dmarc { ruf = Just new_list } - H.modify_ _ { _currentRR { dmarc = Just new_dmarc } } + H.modify_ _ { dmarc { ruf = Just new_list } } handleAction $ ResetTemporaryValues DMARC_remove_rua i -> do