minor robustness fixes in repo cost reordering code
This commit is contained in:
parent
705cb5a84a
commit
69cc8e83ce
2 changed files with 7 additions and 7 deletions
|
@ -187,16 +187,16 @@ getRepositoriesReorderR = do
|
|||
{- Get uuid of the moved item, and the list it was moved within. -}
|
||||
moved <- fromjs <$> runInputGet (ireq textField "moved")
|
||||
list <- map fromjs <$> lookupGetParams "list[]"
|
||||
void $ liftAnnex $ do
|
||||
remote <- fromMaybe (error "Unknown UUID") <$>
|
||||
Remote.remoteFromUUID moved
|
||||
liftAnnex $ go list =<< Remote.remoteFromUUID moved
|
||||
liftAssistant updateSyncRemotes
|
||||
where
|
||||
go _ Nothing = noop
|
||||
go list (Just remote) = do
|
||||
rs <- catMaybes <$> mapM Remote.remoteFromUUID list
|
||||
forM_ (reorderCosts remote rs) $ \(r, newcost) ->
|
||||
when (Remote.cost r /= newcost) $
|
||||
setRemoteCost r newcost
|
||||
remoteListRefresh
|
||||
liftAssistant updateSyncRemotes
|
||||
where
|
||||
void remoteListRefresh
|
||||
fromjs = toUUID . T.unpack
|
||||
|
||||
reorderCosts :: Remote -> [Remote] -> [(Remote, Cost)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue