From 5f3d8a88e2bfa0f7e0be6b383cb7c29ac907c836 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Tue, 3 Dec 2024 11:58:30 +0100 Subject: [PATCH] fix(hlint): implement hlint suggestion --- src/Foundation/SiteLayout.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Foundation/SiteLayout.hs b/src/Foundation/SiteLayout.hs index de88d07f7..6ddc6a6d6 100644 --- a/src/Foundation/SiteLayout.hs +++ b/src/Foundation/SiteLayout.hs @@ -156,7 +156,7 @@ siteLayout' overrideHeading widget = do -- isParent r = r == (fst parents) isAuth <- isJust <$> maybeAuthId - + now <- liftIO getCurrentTime muid <- maybeAuthPair @@ -254,7 +254,7 @@ siteLayout' overrideHeading widget = do forM_ authTagPivots $ \authTag -> addMessageWidget Info $ msgModal [whamlet|_{MsgUnauthorizedDisabledTag authTag}|] (Left $ SomeRoute (AuthPredsR, catMaybes [(toPathPiece GetReferer, ) . toPathPiece <$> mcurrentRoute])) getMessages - + storedReasonAndToggleRoute <- case mcurrentRoute of (Just (CourseR tid ssh csh _)) -> (, Just . SomeRoute $ CourseR tid ssh csh CFavouriteR) <$> storedFavouriteReason tid ssh csh muid _otherwise -> pure (Nothing, Nothing) @@ -266,8 +266,8 @@ siteLayout' overrideHeading widget = do , nav' , contentHeadline , mmsgs - , maybe userDefaultMaxFavouriteTerms userMaxFavouriteTerms $ view _2 <$> muid - , maybe userDefaultTheme userTheme $ view _2 <$> muid + , maybe userDefaultMaxFavouriteTerms (userMaxFavouriteTerms . view _2) muid + , maybe userDefaultTheme (userTheme . view _2) muid , storedReasonAndToggleRoute ) @@ -299,7 +299,7 @@ siteLayout' overrideHeading widget = do | otherwise = Set.drop (Set.size ts - n) ts currentTerms = toTermKeySet $ filter (views (_2 . _Value) . maybe True $ is _FavouriteCurrent) favourites' toTermKeySet = setOf $ folded . _1 . _2 . to unTermKey - + favourites <- fmap catMaybes . forM favourites' $ \(c@(_, tid, ssh, csh), E.Value mFavourite, courseVisible, mayView, mayEdit) -> let courseRoute = CourseR tid ssh csh CShowR favouriteReason = fromMaybe FavouriteCurrent mFavourite @@ -508,7 +508,7 @@ siteLayout' overrideHeading widget = do $(widgetFile "default-layout") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") - + getSystemMessageState :: (MonadHandler m, HandlerSite m ~ UniWorX, BearerAuthSite UniWorX) => SystemMessageId -> m UserSystemMessageState getSystemMessageState smId = liftHandler $ do muid <- maybeAuthId @@ -594,7 +594,7 @@ applySystemMessages = maybeT_ . catchMPlus (Proxy @CryptoIDError) $ do -- FIXME: Move headings into their respective handlers - + -- | Method for specifying page heading for handlers that call defaultLayout -- -- All handlers whose code is under our control should use