gonito/Handler/Announcements.hs
Filip Gralinski 5f4af21006 Switch to more general announcements
Compatibility break: switch NEW_BEST_RESULT_SLACK_HOOK env
to ANNOUNCEMENT_HOOK
2021-08-21 10:26:46 +02:00

25 lines
645 B
Haskell

module Handler.Announcements where
import Import
import Handler.Shared
import Web.Announcements (sendAnnouncement)
getTestAnnouncementsR :: Handler Html
getTestAnnouncementsR = do
app <- getYesod
let webHook = appAnnouncementHook $ appSettings app
let name = case appLocation $ appSettings app of
Just loc -> "Gonito@" ++ loc
Nothing -> "Gonito"
case webHook of
Just hook -> liftIO $ sendAnnouncement hook ("Test message from " ++ (linkInAnnouncement (Just hook) app name ""))
Nothing -> return ()
defaultLayout $ do
setTitle "Test announcements"
$(widgetFile "test-announcements")