From 92b2d09169d742038974bd6d4bf043d041962bed Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 16 Feb 2022 20:01:00 +0100 Subject: [PATCH] chore(system-msgs): add form stub for onVolatileClusterSetting --- src/Handler/SystemMessage.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Handler/SystemMessage.hs b/src/Handler/SystemMessage.hs index 521634de4..28a519ab9 100644 --- a/src/Handler/SystemMessage.hs +++ b/src/Handler/SystemMessage.hs @@ -19,13 +19,16 @@ import Handler.Utils.News import qualified Database.Esqueleto.Legacy as E --- htmlField' moved to Handler.Utils.Form/Fields -invalidateVisibleSystemMessages :: (MonadHandler m, HandlerSite m ~ UniWorX) - => m () -invalidateVisibleSystemMessages - = memcachedByInvalidate AuthCacheVisibleSystemMessages $ Proxy @(Map SystemMessageId (Maybe UTCTime, Maybe UTCTime)) - +invalidateVisibleSystemMessages :: (MonadHandler m, HandlerSite m ~ UniWorX) => m () +invalidateVisibleSystemMessages = memcachedByInvalidate AuthCacheVisibleSystemMessages $ Proxy @(Map SystemMessageId (Maybe UTCTime, Maybe UTCTime)) + + +-- TODO: work in progress +systemMessageVolatileClusterSettingsForm :: Maybe SystemMessageVolatileClusterSettings -> AForm Handler SystemMessageVolatileClusterSettings +systemMessageVolatileClusterSettingsForm _mPrev = wFormToAForm $ do + return mempty + getMessageR, postMessageR :: CryptoUUIDSystemMessage -> Handler Html getMessageR = postMessageR @@ -44,6 +47,7 @@ postMessageR cID = do $ SystemMessage <$> aopt utcTimeField (fslI MsgSystemMessageFrom) (Just systemMessageFrom) <*> aopt utcTimeField (fslI MsgSystemMessageTo) (Just systemMessageTo) + <*> systemMessageVolatileClusterSettingsForm (Just systemMessageOnVolatileClusterSettings) <*> apopt checkBoxField (fslI MsgSystemMessageNewsOnly) (Just systemMessageNewsOnly) <*> apopt checkBoxField (fslI MsgSystemMessageAuthenticatedOnly) (Just systemMessageAuthenticatedOnly) <*> areq (selectField optionsFinite) (fslI MsgSystemMessageSeverity) (Just systemMessageSeverity) @@ -290,6 +294,7 @@ postMessageListR = do ((addRes, addView), addEncoding) <- runFormPost . identifyForm FIDSystemMessageAdd . renderAForm FormStandard $ SystemMessage <$> aopt utcTimeField (fslI MsgSystemMessageFrom) (Just Nothing) <*> aopt utcTimeField (fslI MsgSystemMessageTo) (Just Nothing) + <*> systemMessageVolatileClusterSettingsForm Nothing <*> apopt checkBoxField (fslI MsgSystemMessageNewsOnly) (Just False) <*> apopt checkBoxField (fslI MsgSystemMessageAuthenticatedOnly) (Just False) <*> areq (selectField optionsFinite) (fslI MsgSystemMessageSeverity) (Just Info)