diff --git a/src/Foundation.hs b/src/Foundation.hs index f5b4fa18c..8b97c9317 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -1103,8 +1103,13 @@ instance Yesod UniWorX where headerMessagesMiddleware handler = (handler `finally`) . runMaybeT $ do isModal <- hasCustomHeader HeaderIsModal dbTableShortcircuit <- hasCustomHeader HeaderDBTableShortcircuit - $logDebugS "headerMessagesMiddleware" $ tshow (isModal, dbTableShortcircuit) - guard $ isModal || dbTableShortcircuit + massInputShortcircuit <- hasCustomHeader HeaderMassInputShortcircuit + $logDebugS "headerMessagesMiddleware" $ tshow (isModal, dbTableShortcircuit, massInputShortcircuit) + guard $ or + [ isModal + , dbTableShortcircuit + , massInputShortcircuit + ] lift . bracketOnError getMessages (mapM_ $ uncurry Yesod.addMessage) $ \msgs -> do Just msgs' <- return . forM msgs $ \(msgState, content) -> Message <$> fromPathPiece msgState <*> return content diff --git a/src/Handler/Utils/Form/MassInput.hs b/src/Handler/Utils/Form/MassInput.hs index 9119b031a..cd5e4f5ac 100644 --- a/src/Handler/Utils/Form/MassInput.hs +++ b/src/Handler/Utils/Form/MassInput.hs @@ -21,7 +21,7 @@ import Handler.Utils.Form (secretJsonField) import Handler.Utils.Form.MassInput.Liveliness import Handler.Utils.Form.MassInput.TH -import Data.Aeson +import Data.Aeson hiding (Result(..)) import Algebra.Lattice hiding (join) @@ -423,6 +423,10 @@ massInput MassInput{ miIdent = toPathPiece -> miIdent, ..} FieldSettings{..} fvR PageContent{..} <- widgetToPageContent $(widgetFile "widgets/massinput/massinput-standalone") ur <- getUrlRenderParams + case result of + FormFailure errs -> forM_ errs $ addMessage Error . toHtml -- Error messages get collected by middleware and added as header to response + _other -> return () -- Completely ignore non-error results; we'll short circuit below + sendResponse $ $(hamletFile "templates/widgets/massinput/massinput-standalone-wrapper.hamlet") ur let