Refactor toward general announcements cntd.
This commit is contained in:
parent
2a6515d872
commit
8e9df1c311
@ -3,7 +3,7 @@ module Handler.Announcements where
|
||||
import Import
|
||||
|
||||
import Handler.Shared
|
||||
import Web.Announcements (runSlackHook)
|
||||
import Web.Announcements (sendAnnouncement)
|
||||
|
||||
getTestAnnouncementsR :: Handler Html
|
||||
getTestAnnouncementsR = do
|
||||
@ -16,7 +16,7 @@ getTestAnnouncementsR = do
|
||||
Nothing -> "Gonito"
|
||||
|
||||
case webHook of
|
||||
Just hook -> liftIO $ runSlackHook hook ("Test message from " ++ (slackLink app name ""))
|
||||
Just hook -> liftIO $ sendAnnouncement hook ("Test message from " ++ (slackLink app name ""))
|
||||
Nothing -> return ()
|
||||
|
||||
defaultLayout $ do
|
||||
|
@ -973,7 +973,7 @@ doCreateSubmission' _ userId challengeId challengeSubmissionData chan = do
|
||||
msg chan message
|
||||
case appNewBestResultSlackHook $ appSettings app of
|
||||
Just "" -> return ()
|
||||
Just hook -> liftIO $ runSlackHook hook message
|
||||
Just hook -> liftIO $ sendAnnouncement hook message
|
||||
|
||||
Nothing -> return ()
|
||||
else return ()
|
||||
@ -1022,7 +1022,7 @@ checkTarget theNow user submissionLink entries indicator target chan = do
|
||||
msg chan message
|
||||
case appNewBestResultSlackHook $ appSettings app of
|
||||
Just "" -> return ()
|
||||
Just hook -> liftIO $ runSlackHook hook message
|
||||
Just hook -> liftIO $ sendAnnouncement hook message
|
||||
Nothing -> return ()
|
||||
else
|
||||
return ()
|
||||
|
@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Web.Announcements
|
||||
(runSlackHook,
|
||||
(sendAnnouncement,
|
||||
formatLink)
|
||||
where
|
||||
|
||||
@ -15,8 +15,8 @@ import Data.Aeson
|
||||
import Data.Default
|
||||
|
||||
|
||||
runSlackHook :: Text -> Text -> IO ()
|
||||
runSlackHook hook message = do
|
||||
sendAnnouncement :: Text -> Text -> IO ()
|
||||
sendAnnouncement hook message = do
|
||||
let (Just (hookUrl, _)) = parseUrlHttps $ DTE.encodeUtf8 hook
|
||||
|
||||
R.runReq def $ do
|
||||
|
Loading…
Reference in New Issue
Block a user