fix combining of pairing alerts

This commit is contained in:
Joey Hess 2012-09-11 15:43:33 -04:00
parent 4227050bbe
commit 99d52f26bc
3 changed files with 8 additions and 10 deletions

View file

@ -294,12 +294,8 @@ pairingAlert button = baseActivityAlert
} }
pairRequestReceivedAlert :: String -> AlertButton -> Alert pairRequestReceivedAlert :: String -> AlertButton -> Alert
pairRequestReceivedAlert repo button = Alert pairRequestReceivedAlert repo button = baseActivityAlert
{ alertClass = Message { alertData = [UnTensed $ T.pack $ repo ++ " is sending a pair request."]
, alertHeader = Nothing
, alertMessageRender = tenseWords
, alertData = [UnTensed $ T.pack $ repo ++ " is sending a pair request."]
, alertBlockDisplay = False
, alertPriority = High , alertPriority = High
, alertClosable = True , alertClosable = True
, alertIcon = Just InfoIcon , alertIcon = Just InfoIcon
@ -308,13 +304,13 @@ pairRequestReceivedAlert repo button = Alert
, alertButton = Just button , alertButton = Just button
} }
pairRequestAcknowledgedAlert :: String -> AlertButton -> Alert pairRequestAcknowledgedAlert :: String -> (Maybe AlertButton) -> Alert
pairRequestAcknowledgedAlert repo button = baseActivityAlert pairRequestAcknowledgedAlert repo button = baseActivityAlert
{ alertData = ["Pair request with", UnTensed (T.pack repo), Tensed "in progress" "complete"] { alertData = ["Pair request with", UnTensed (T.pack repo), Tensed "in progress" "complete"]
, alertPriority = High , alertPriority = High
, alertName = Just $ PairAlert repo , alertName = Just $ PairAlert repo
, alertCombiner = Just $ dataCombiner $ \_old new -> new , alertCombiner = Just $ dataCombiner $ \_old new -> new
, alertButton = Just button , alertButton = button
} }
fileAlert :: TenseChunk -> FilePath -> Alert fileAlert :: TenseChunk -> FilePath -> Alert

View file

@ -109,10 +109,12 @@ pairReqReceived False dstatus urlrenderer msg = do
AlertButton AlertButton
{ buttonUrl = url { buttonUrl = url
, buttonLabel = T.pack "Respond" , buttonLabel = T.pack "Respond"
, buttonAction = Nothing , buttonAction = Just onclick
} }
where where
repo = pairRepo msg repo = pairRepo msg
onclick = \i -> updateAlert dstatus i $ const $ Just $
pairRequestAcknowledgedAlert repo Nothing
{- When a verified PairAck is seen, a host is ready to pair with us, and has {- When a verified PairAck is seen, a host is ready to pair with us, and has
- already configured our ssh key. Stop sending PairReqs, finish the pairing, - already configured our ssh key. Stop sending PairReqs, finish the pairing,

View file

@ -56,7 +56,7 @@ getFinishPairR msg = promptSecret (Just msg) $ \_ secret -> do
liftIO $ setup liftIO $ setup
startPairing PairAck cleanup alert uuid "" secret startPairing PairAck cleanup alert uuid "" secret
where where
alert = pairRequestAcknowledgedAlert $ pairRepo msg alert = pairRequestAcknowledgedAlert (pairRepo msg) . Just
setup = setupAuthorizedKeys msg setup = setupAuthorizedKeys msg
cleanup = removeAuthorizedKeys False $ cleanup = removeAuthorizedKeys False $
remoteSshPubKey $ pairMsgData msg remoteSshPubKey $ pairMsgData msg