2021-08-21 09:28:19 +02:00
|
|
|
module Handler.Announcements where
|
|
|
|
|
|
|
|
import Import
|
|
|
|
|
|
|
|
import Handler.Shared
|
2021-08-21 09:49:30 +02:00
|
|
|
import Web.Announcements (sendAnnouncement)
|
2021-08-21 09:28:19 +02:00
|
|
|
|
|
|
|
getTestAnnouncementsR :: Handler Html
|
|
|
|
getTestAnnouncementsR = do
|
|
|
|
app <- getYesod
|
|
|
|
|
2021-08-21 10:26:46 +02:00
|
|
|
let webHook = appAnnouncementHook $ appSettings app
|
2021-08-21 09:28:19 +02:00
|
|
|
|
|
|
|
let name = case appLocation $ appSettings app of
|
|
|
|
Just loc -> "Gonito@" ++ loc
|
|
|
|
Nothing -> "Gonito"
|
|
|
|
|
|
|
|
case webHook of
|
2021-08-21 10:26:46 +02:00
|
|
|
Just hook -> liftIO $ sendAnnouncement hook ("Test message from " ++ (linkInAnnouncement (Just hook) app name ""))
|
2021-08-21 09:28:19 +02:00
|
|
|
Nothing -> return ()
|
|
|
|
|
|
|
|
defaultLayout $ do
|
|
|
|
setTitle "Test announcements"
|
|
|
|
$(widgetFile "test-announcements")
|