Create collection: only update url after pushed to server.

Without this change, if the putting on server of a new collection fails,
the url would already be updated, and since having a url indicates it
exists on the server, trying to save it later would result in a 404.
pull/5/head
Tom Hacohen 7 years ago
parent 32df64000f
commit f84bd386f1

@ -153,8 +153,8 @@ public class CreateCollectionFragment extends DialogFragment implements LoaderMa
if (info.url == null) {
// CollectionInfo doesn't have a url at this point, update it.
JournalManager.Journal journal = new JournalManager.Journal(settings.password(), info.toJson());
info.url = journal.getUuid();
journalManager.putJournal(journal);
info.url = journal.getUuid();
} else {
JournalManager.Journal journal = new JournalManager.Journal(settings.password(), info.toJson(), info.url);
journalManager.updateJournal(journal);

Loading…
Cancel
Save