From 1a4c3caa965f1b212db70c48b2da9b7864c00670 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 20 Apr 2014 15:10:29 -0400 Subject: [PATCH] avoid showing the connection nudge alert after creating git or gcrypt remote --- Assistant/WebApp/Configurators/Ssh.hs | 9 ++++++--- Assistant/WebApp/MakeRemote.hs | 14 ++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Assistant/WebApp/Configurators/Ssh.hs b/Assistant/WebApp/Configurators/Ssh.hs index 90a8c520fd..bc9eb6b627 100644 --- a/Assistant/WebApp/Configurators/Ssh.hs +++ b/Assistant/WebApp/Configurators/Ssh.hs @@ -403,11 +403,14 @@ prepSsh' newgcrypt origsshdata sshdata keypair a = sshSetup rsynconly = onlyCapability origsshdata RsyncCapable makeSshRepo :: SshData -> Handler Html -makeSshRepo sshdata = setupCloudRemote TransferGroup Nothing $ - makeSshRemote sshdata +makeSshRepo sshdata + | onlyCapability sshdata RsyncCapable = setupCloudRemote TransferGroup Nothing go + | otherwise = setupRemote EditNewRepositoryR TransferGroup Nothing go + where + go = makeSshRemote sshdata makeGCryptRepo :: KeyId -> SshData -> Handler Html -makeGCryptRepo keyid sshdata = setupCloudRemote TransferGroup Nothing $ +makeGCryptRepo keyid sshdata = setupRemote EditNewRepositoryR TransferGroup Nothing $ makeGCryptRemote (sshRepoName sshdata) (genSshUrl sshdata) keyid getAddRsyncNetR :: Handler Html diff --git a/Assistant/WebApp/MakeRemote.hs b/Assistant/WebApp/MakeRemote.hs index 749fbd5282..875313727b 100644 --- a/Assistant/WebApp/MakeRemote.hs +++ b/Assistant/WebApp/MakeRemote.hs @@ -26,12 +26,18 @@ import Utility.Yesod {- Runs an action that creates or enables a cloud remote, - and finishes setting it up, then starts syncing with it, - - and finishes by displaying the page to edit it. -} + - and finishes by displaying the page to edit it. + - + - This includes displaying the connectionNeeded nudge if appropariate. + -} setupCloudRemote :: StandardGroup -> Maybe Cost -> Annex RemoteName -> Handler a -setupCloudRemote defaultgroup mcost name = do - r <- liftAnnex $ addRemote name +setupCloudRemote = setupRemote EditNewCloudRepositoryR + +setupRemote :: (UUID -> Route WebApp) -> StandardGroup -> Maybe Cost -> Annex RemoteName -> Handler a +setupRemote redirto defaultgroup mcost getname = do + r <- liftAnnex $ addRemote getname liftAnnex $ do setStandardGroup (Remote.uuid r) defaultgroup maybe noop (Config.setRemoteCost (Remote.repo r)) mcost liftAssistant $ syncRemote r - redirect $ EditNewCloudRepositoryR $ Remote.uuid r + redirect $ redirto $ Remote.uuid r