Commit graph

62 commits

Author SHA1 Message Date
Dan Stillman
4b7cdddb4a Change apply-to-all checkbox text for some conflicts
Say "Use the [local|remote] version for all remaining conflicts" for
everything instead of saying "Use [local|remote] fields for all
remaining conflicts" for some conflicts.

This also fixes a test failure after 54343c49fb.
2019-09-21 01:35:36 -04:00
Dan Stillman
f04f186396 Add missing yield in sync code 2019-09-16 00:47:45 -04:00
Dan Stillman
985f10d5ed Fix WebDAV test after 1f1b2e9b2 2019-06-03 03:35:32 -04:00
Dan Stillman
c0e2aa03d3 Fix test for delay after second library version conflict 2019-05-31 02:44:41 -04:00
Dan Stillman
9a304b6699 Better handling of remotely changed items in locally missing collections 2018-04-07 17:04:35 -04:00
Dan Stillman
ac4abf0ebb Avoid race conditions in conflict resolution tests 2018-04-07 17:04:00 -04:00
Dan Stillman
c0b63e5928 Better handling of 403 for attachment metadata upload
Check file-editing access for the group from the API before offering to
reset, update the filesEditable setting properly, and restart the sync
automatically after resetting.
2018-02-23 17:59:32 -05:00
Dan Stillman
c5fa1303e3 Prompt to reset local group files on 403 for file attachment upload
And reset modified file attachments when resetting files
2018-01-26 03:37:57 -05:00
Dan Stillman
d67c654245 Add version option to toResponseJSON() 2018-01-26 03:37:57 -05:00
Dan Stillman
df38f4ded7 Avoid upload retry loops
- Don't try uploading an object more than 5 times
- Don't retry a child item if the parent item failed too
2017-12-10 03:45:08 -05:00
Dan Stillman
f353b7ca61 API-based "Restore to Online Library"
Restores the "Restore to Zotero Server" functionality, now using the
API:

1. Get all remote keys and send `DELETE` for any that don't exist
   locally.
2. Upload all local objects in full (non-patch) mode using only library
   version so that the remotes are overwritten.
3. Reset file sync history, causing all files to be uploaded (or, more
   likely, reassociated with existing remote files).

Since these are treated as regular updates on the server, they'll sync
down to other clients normally. Unsynced changes by other clients might
still trigger conflicts.

This and Reset File Sync History can also now be run on group libraries,
with a library selector in the Reset pane (which I forgot to do with
React).

The full sync option is now removed from the Reset pane, since there
wasn't ever really a reason to run it manually.

We should be able to reimplement Restore from Online Library (#1386)
using the inverse of this approach.

Closes #914
2017-12-08 00:42:03 -05:00
Dan Stillman
34028d354e Don't try to delete Quick Start Guide items in test
We don't create these items anymore.
2017-10-27 01:09:34 -04:00
Dan Stillman
f0770fa84d Fix various conflict resolution bugs
Among other things, when choosing the local side for a conflict, the
remote version could still end up being saved.
2017-10-27 01:08:38 -04:00
Dan Stillman
d81e2a5cf0 Fix sync errors from remote item referencing deleted local collection 2017-09-20 05:33:44 -04:00
Dan Stillman
9069559050 Improve logic for determining whether to check for files to download
This should fix cases of files not being downloaded after interrupted
syncs until the next time files were changed remotely.
2017-08-11 22:29:40 +02:00
Dan Stillman
47741e75fa Restore locally deleted collections and searches that changed remotely
Also restore items that were in the collections
2017-06-18 09:11:21 -04:00
Dan Stillman
40da5f61a0 Still process downloads if uploads fail for a library 2017-05-05 03:26:29 -04:00
Dan Stillman
a1bd2bace5 Remove objects from sync queue if missing from response
While objects in the sync queue that fail to save should remain in the
queue, objects that just don't exist remotely need to be removed, or
else they'll be retried forever.
2017-05-05 01:04:16 -04:00
Dan Stillman
7a839e19a6 Fix background/stopOnError options for sync engine tests 2017-05-05 00:26:43 -04:00
Dan Stillman
5b0b874435 Purge old objects in sync cache after upload 2017-05-03 03:43:59 -04:00
Dan Stillman
fe88530120 Recover from a remotely missing parent collection 2017-04-28 03:18:50 -04:00
Dan Stillman
d8fed09578 Mark local collection as unsynced if missing remotely in item request
We should figure out when this happens, but in the meantime, recover
from it if it does.
2017-04-07 00:57:50 -04:00
Dan Stillman
34c90fd156 If parent item is missing remotely, mark as unsynced and add to queue
This shouldn't happen, but there've been some reports of it.
2017-02-16 18:05:48 -05:00
Dan Stillman
8f0ed56ae2 Test fixes after 5bceebf56c 2016-11-29 03:52:07 -05:00
Dan Stillman
8aee80106d Fix errors uploading remotely missing objects with local version numbers
If an object exists locally but not remotely and the local version has a
version number, that's an error. I don't think that should ever happen,
but it can if things somehow get out of sync due to other bugs.

To address, reprocess the API delete log during a full sync and then
reset the version number of all remaining local objects that don't exist
remotely (not just unmodified objects, as was the case previously) to 0
for uploading.

When remote deletions are reprocessed, delete local objects that haven't
been modified and show the conflict resolution window for any local
items that have.

Also:

- Clean up checking of last remote library version during download
  syncs
- Add Zotero.DataObjects.getAllKeys()
2016-08-20 14:56:31 -04:00
Dan Stillman
41eb49cf7f Fix handling of object-level 404/412 errors 2016-08-15 02:26:04 -04:00
Dan Stillman
976b5c82c6 Fix error delaying on second library upload conflict 2016-08-14 17:23:02 -04:00
Dan Stillman
7ea5bab206 Fix delaying if remote library version changes during downloads 2016-08-13 03:34:29 -04:00
Dan Stillman
d5b2f67afa Automatically resolve item deletion/trash conflicts
If the item was deleted on one side and moved to the trash on the other,
just delete the item on the trash side. Since trash emptying happens
automatically, this would otherwise result in a conflict even if the
user carefully avoided making changes before a manual sync.
2016-07-30 23:03:30 -04:00
Dan Stillman
1bd058ed48 Prompt for library data reset on 403 upload error
Addresses #1041 for data -- still needed for files
2016-07-19 22:12:13 -04:00
Dan Stillman
d44eeb752b Fix error on CR of child note, and show parent item title in merge pane 2016-07-07 05:18:02 -04:00
Dan Stillman
48a072d254 Update library version after settings upload 2016-06-22 05:58:12 -04:00
Dan Stillman
6a97de8911 Update outdated Libraries.setVersion() calls in syncEngine tests 2016-05-23 01:28:50 -04:00
Dan Stillman
f8716fbe88 Don't change Date Modified when updating local item after upload
If the API returns a modified item after an upload (e.g., to strip invalid
characters), don't update the Date Modified field when saving those changes to
the local version (though it would still be good to avoid API-side changes as
much as possible).
2016-05-21 16:33:46 -04:00
Dan Stillman
99eb39e288 Always include 'contentType'/'charset'/'filename' in attachment JSON
And omit in ZFS file sync requests

The API previously didn't allow these properties to be set for group items,
because they were set atomically during the file upload process, but 1) that's
not really necessary (makes a little sense for 'filename', but not really a big
deal if an old file is renamed on another computer before the new file is
synced down) and 2) skipping them results in the properties getting erased
after items are uploaded and the empty values returned by the server overwrite
the local values.
2016-05-21 16:33:35 -04:00
Dan Stillman
59c0c7fcad Don't include file properties for ZFS-synced libraries
They're disallowed by the API in group libraries and not necessary in personal
libraries, because they're set atomically with the file upload.
2016-05-12 17:00:28 -04:00
Dan Stillman
a78f923a72 Sync engine cleanup
- Use custom exception for user-initiated sync cancellations, which can bubble
  up to the sync runner -- this should help with a sync stop button (#915)
- Separate out deletions-downloading code
- Refactor delay generator handling on library version mismatch
- Clearer variable names
2016-05-06 04:31:49 -04:00
Dan Stillman
cd5e805b9e Sync logic improvements
- Cancel sync when cancelling conflict resolution window
- Don't try to upload unsynced objects if present in sync queue
2016-05-04 01:39:24 -04:00
Dan Stillman
391f525a75 Close #975, Process conflicts for all batches together 2016-05-03 23:18:42 -04:00
Dan Stillman
e8aec31715 Fix various cases of sync errors with read-only libraries
Addresses #983
2016-05-03 02:55:26 -04:00
Dan Stillman
295e9f3ecf Don't retry cancelled conflicts immediately
If other items were saved in the same batch, the conflict resolution
window could reappear immediately after cancelling it.
2016-04-27 05:45:35 -04:00
Dan Stillman
f82fb89e1c Sort parent collections and items first in uploads
Closes #972
2016-04-25 20:16:31 -04:00
Dan Stillman
87a2eece3a Fix #959, 5.0: Submit to Zotero Server is not working 2016-04-24 04:04:40 -04:00
Dan Stillman
f633db1f01 Miscellaneous tweaks 2016-04-23 00:59:20 -04:00
Dan Stillman
3dabd63a0a Close #930, [API Syncing] Sync synced settings 2016-04-19 05:22:16 -04:00
Dan Stillman
b7b246e741 Saved search fixes
- Fix saved search editing
- Refresh items list on search change
- Generate correct conditions array for search JSON
2016-03-26 04:14:56 -04:00
Dan Stillman
a1ce85decb Overhaul object downloading/processing during data syncs
Previously, objects were first downloaded and saved to the sync cache,
which was then processed separately to create/update local objects. This
meant that a server bug could result in invalid data in the sync cache
that would never be processed. Now, objects are saved as they're
downloaded and only added to the sync cache after being successfully
saved. The keys of objects that fail are added to a queue, and those
objects are refetched and retried on a backoff schedule or when a new
client version is installed (in case of a client bug or a client with
outdated data model support).

An alternative would be to save to the sync cache first and evict
objects that fail and add them to the queue, but that requires more
complicated logic, and it probably makes more sense just to buffer a few
downloads ahead so that processing is never waiting for downloads to
finish.
2016-03-23 04:29:04 -04:00
Dan Stillman
8e5016ae4d Load synced settings (incl. tag colors) at startup 2016-03-15 01:18:55 -04:00
Dan Stillman
daf4a8fe4d Deasyncification 🔙 😢
While trying to get translation and citing working with asynchronously
generated data, we realized that drag-and-drop support was going to
be...problematic. Firefox only supports synchronous methods for
providing drag data (unlike, it seems, the DataTransferItem interface
supported by Chrome), which means that we'd need to preload all relevant
data on item selection (bounded by export.quickCopy.dragLimit) and keep
the translate/cite methods synchronous (or maintain two separate
versions).

What we're trying instead is doing what I said in #518 we weren't going
to do: loading most object data on startup and leaving many more
functions synchronous. Essentially, this takes the various load*()
methods described in #518, moves them to startup, and makes them operate
on entire libraries rather than individual objects.

The obvious downside here (other than undoing much of the work of the
last many months) is that it increases startup time, potentially quite a
lot for larger libraries. On my laptop, with a 3,000-item library, this
adds about 3 seconds to startup time. I haven't yet tested with larger
libraries. But I'm hoping that we can optimize this further to reduce
that delay. Among other things, this is loading data for all libraries,
when it should be able to load data only for the library being viewed.
But this is also fundamentally just doing some SELECT queries and
storing the results, so it really shouldn't need to be that slow (though
performance may be bounded a bit here by XPCOM overhead).

If we can make this fast enough, it means that third-party plugins
should be able to remain much closer to their current designs. (Some
things, including saving, will still need to be made asynchronous.)
2016-03-07 17:03:58 -05:00
Dan Stillman
f05b98ba20 Fetch top-level items before other items when syncing 2016-01-14 01:50:13 -05:00