{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} -- ihamletFile discards do results module Jobs.Handler.SendNotification.SheetActive ( dispatchNotificationSheetActive ) where import Import import Handler.Utils.Mail import Jobs.Handler.SendNotification.Utils import Text.Hamlet import qualified Data.CaseInsensitive as CI dispatchNotificationSheetActive :: SheetId -> UserId -> Handler () dispatchNotificationSheetActive nSheet jRecipient = userMailT jRecipient $ do (Course{..}, Sheet{..}) <- liftHandlerT . runDB $ do sheet <- getJust nSheet course <- belongsToJust sheetCourse sheet return (course, sheet) setSubjectI $ MsgMailSubjectSheetActive courseShorthand sheetName MsgRenderer mr <- getMailMsgRenderer let termDesc = mr . ShortTermIdentifier $ unTermKey courseTerm tid = courseTerm ssh = courseSchool csh = courseShorthand shn = sheetName editNotifications <- mkEditNotifications jRecipient addAlternatives $ do providePreferredAlternative ($(ihamletFile "templates/mail/sheetActive.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))