Raise SEQUENCE when a create falls back to an update (#137)
This commit is contained in:
1 parent
4765344d50
commit
33466dc6d9
2 files changed
+13
-1
No files matched your search
@@ -499,7 +499,9 @@ class CollectionSyncer(
|
||||
val existing = fetched.resources.firstOrNull()
|
||||
val sameTask = existing != null && uidOf(existing.iCalendar) == local.uid
|
||||
if (sameTask) {
|
||||
updateResource(local, outcome.href.toString(), body)
|
||||
// An update now, so SEQUENCE goes up as on any other (#137).
|
||||
val revised = local.revised()
|
||||
updateResource(revised, outcome.href.toString(), serialize(revised) ?: return)
|
||||
return
|
||||
}
|
||||
name = ResourceNames.random()
|
||||
|
||||
@@ -724,6 +724,16 @@ class CollectionSyncerTest {
|
||||
assertThat(store.rows.single().href).isEqualTo("http://server/dav/tasks/a.ics")
|
||||
}
|
||||
|
||||
@Test fun `an adopted name goes up with a raised SEQUENCE`() {
|
||||
remote.put("a.ics", vtodo("a", "Uploaded last time"))
|
||||
store.rows += task(id = 1, uid = "a", title = "Ours").copy(sequence = 2, isDirty = true)
|
||||
|
||||
sync()
|
||||
|
||||
assertThat(remote.resources.values.single().body).contains("SEQUENCE:3")
|
||||
assertThat(store.rows.single().sequence).isEqualTo(3)
|
||||
}
|
||||
|
||||
@Test fun `a create whose verification fetch fails is not duplicated`() {
|
||||
// Our own PUT from a run whose answer never arrived, and an edit the user
|
||||
// made afterwards that only exists here.
|
||||
|
||||
Reference in new issue
Block a user