From 54c91986698b64cb1e4efa27bc524193dcfb9b8e Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 10 May 2023 15:18:58 +0000 Subject: [PATCH] chore(forms): revert apreq change and use areq directly for boolFields with defaults --- models/company.model | 2 +- src/Handler/Admin/Avs.hs | 2 +- src/Utils/Form.hs | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/models/company.model b/models/company.model index 883aba0ff..5443b64b0 100644 --- a/models/company.model +++ b/models/company.model @@ -13,7 +13,7 @@ Company UniqueCompanyName name UniqueCompanyShorthand shorthand -- UniqueCompanyAvsId avsId -- should be the case, unclear if enforcing works here, since we cannot query avs by company id - Primary shorthand -- newtype Key Company = CompanyKey { unSchoolKey :: CompanyShorthand } + Primary shorthand -- newtype Key Company = CompanyKey { unCompanyKey :: CompanyShorthand } deriving Ord Eq Show Generic Binary -- TODO: a way to populate this table (manually) diff --git a/src/Handler/Admin/Avs.hs b/src/Handler/Admin/Avs.hs index 62ac59f13..746a89a7f 100644 --- a/src/Handler/Admin/Avs.hs +++ b/src/Handler/Admin/Avs.hs @@ -605,7 +605,7 @@ mkLicenceTable apidStatus dbtIdent aLic apids = do then singletonMap LicenceTableRevokeFDrive $ LicenceTableRevokeFDriveData <$> apreq (selectField . fmap mkOptionList $ mapM qualOpt avsQualifications) (fslI MsgQualificationName) aLicQid <*> apreq textField (fslI MsgQualificationBlockReason) Nothing - <*> apreq (boolField . Just $ SomeMessage MsgBoolIrrelevant) (fslI MsgQualificationBlockNotify) (Just False) + <*> areq (boolField . Just $ SomeMessage MsgBoolIrrelevant) (fslI MsgQualificationBlockNotify) (Just False) else singletonMap LicenceTableGrantFDrive $ LicenceTableGrantFDriveData <$> apreq (selectField . fmap mkOptionList $ mapM qualOpt avsQualifications) (fslI MsgQualificationName) aLicQid diff --git a/src/Utils/Form.hs b/src/Utils/Form.hs index 79a3604b1..669c6c440 100644 --- a/src/Utils/Form.hs +++ b/src/Utils/Form.hs @@ -1667,8 +1667,7 @@ mpreq :: (RenderMessage site (ValueRequired site), HandlerSite m ~ site, MonadHa -- ^ Pseudo required -- -- `FieldView` has `fvRequired` set to `True` and @FormSuccess Nothing@ is cast to `FormFailure`. --- Otherwise acts exactly like `mopt` without a default value and like `mreq` with a given default value -mpreq f fs mx@(Just _) = mreq f fs mx -- This shortcut hides the invalid no-answer option if a default is provided +-- Otherwise acts exactly like `mopt`. Note that a shortcut to mreq for isJust mx does create problems mit checkBoxField mpreq f fs@FieldSettings{..} mx = do mr <- getMessageRender (res, fv') <- mpreq' f fs $ Just <$> mx