From 2b9c2602bfbf05dac951b868c86941d77e6e579c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 11 Aug 2020 10:56:43 +0200 Subject: [PATCH] refactor: hlint --- src/Foundation.hs | 4 ++-- src/Handler/Sheet/Edit.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 489587bff..9a1200ab5 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -1650,8 +1650,8 @@ wouldHaveReadAccessToIff, wouldHaveWriteAccessToIff => [(AuthTag, Bool)] -- ^ Assumptions -> Route UniWorX -> m Bool -wouldHaveReadAccessToIff assumptions route = and2M (fmap not $ hasReadAccessTo route) $ wouldHaveReadAccessTo assumptions route -wouldHaveWriteAccessToIff assumptions route = and2M (fmap not $ hasWriteAccessTo route) $ wouldHaveWriteAccessTo assumptions route +wouldHaveReadAccessToIff assumptions route = and2M (not <$> hasReadAccessTo route) $ wouldHaveReadAccessTo assumptions route +wouldHaveWriteAccessToIff assumptions route = and2M (not <$> hasWriteAccessTo route) $ wouldHaveWriteAccessTo assumptions route -- | Conditional redirect that hides the URL if the user is not authorized for the route redirectAccess :: (MonadThrow m, MonadHandler m, HandlerSite m ~ UniWorX) => Route UniWorX -> m a diff --git a/src/Handler/Sheet/Edit.hs b/src/Handler/Sheet/Edit.hs index 9d128c4f8..4857e6646 100644 --- a/src/Handler/Sheet/Edit.hs +++ b/src/Handler/Sheet/Edit.hs @@ -86,7 +86,7 @@ handleSheetEdit tid ssh csh msId template dbAction = do , sheetAutoDistribute = sfAutoDistribute , sheetAnonymousCorrection = sfAnonymousCorrection , sheetRequireExamRegistration = sfRequireExamRegistration - , sheetAllowNonPersonalisedSubmission = fromMaybe True $ spffAllowNonPersonalisedSubmission <$> sfPersonalF + , sheetAllowNonPersonalisedSubmission = maybe True spffAllowNonPersonalisedSubmission sfPersonalF } mbsid <- dbAction newSheet case mbsid of @@ -98,7 +98,7 @@ handleSheetEdit tid ssh csh msId template dbAction = do insertSheetFile' sid SheetMarking $ fromMaybe (return ()) sfMarkingF runConduit $ maybe (return ()) (transPipe liftHandler) (spffFiles =<< sfPersonalF) - .| sinkPersonalisedSheetFiles cid sid (fromMaybe False $ spffFilesKeepExisting <$> sfPersonalF) + .| sinkPersonalisedSheetFiles cid sid (maybe False spffFilesKeepExisting sfPersonalF) insert_ $ SheetEdit aid actTime sid addMessageI Success $ MsgSheetEditOk tid ssh csh sfName -- Sanity checks generating warnings only, but not errors!