add XMPP nudge alert, displayed after making a cloud repository

This commit is contained in:
Joey Hess 2012-10-27 12:25:29 -04:00
parent ab15e567f9
commit 531f1d1446
7 changed files with 36 additions and 2 deletions

View file

@ -13,6 +13,8 @@ module Assistant.WebApp.Configurators.XMPP where
import Assistant.WebApp
import Assistant.WebApp.Types
import Assistant.WebApp.SideBar
import Assistant.Alert
import Assistant.DaemonStatus
import Utility.Yesod
#ifdef WITH_XMPP
import Assistant.Common
@ -29,6 +31,17 @@ import Data.Text (Text)
import qualified Data.Text as T
#endif
{- Displays an alert suggesting to configure XMPP, with a button. -}
xmppNeeded :: Handler ()
xmppNeeded = whenM (isNothing <$> runAnnex Nothing getXMPPCreds) $ do
dstatus <- daemonStatus <$> getYesod
urlrender <- getUrlRender
void $ liftIO $ addAlert dstatus $ xmppNeededAlert $ AlertButton
{ buttonLabel = "Configure a Jabber account"
, buttonUrl = urlrender XMPPR
, buttonAction = Just $ removeAlert dstatus
}
getXMPPR :: Handler RepHtml
#ifdef WITH_XMPP
getXMPPR = xmppPage $ do