Attachments are now saved before the connector server responds, because they're
no longer started out-of-band in saveItems(). This is necessary to prevent
transaction badness during imports, but it may not be what we want for the
connector, so we may want to revisit this after further testing.
E.g., moving 3,600 items to the trash now takes 4 seconds instead of 62
Instead of saving each item, update internal state and database directly
(which is more brittle but worth it). Also avoid unnecessary sorting
after removing an item from the items tree.
This allows for imported items to be saved individually instead of being
saved in a batch after processing the entire imported file (which for
large imports would hang the UI, even if the actual saving was
asynchronous). This also fixes the progress meter during asynchronous
saves.
To take advantage of this, import translators will need to return a
promise when available (using the native Promise object) from doImport()
and wait for optional promises from item.complete().
The logic here can probably be streamlined further. (E.g., we might be
able to say that item.complete() always returns a promise.) It's
complicated by the fact that, at the moment, Promise isn't available in
child sandboxes, though this can probably be fixed.
Tests forthcoming, but they require a translator that supports this,
which needs to be committed separately.
View with -w for a cleaner diff.
This (and some other things) will help avoid changes in uploaded notes, which
cause loss of cursor position and other problems after local notes are updated
with the server version.
A side effect is that multiple spaces won't be converted to ` `, so
anything consuming note content will have to use `white-space: pre`.
(Notes in reports appear to be substituting ` ` as necessary,
though I'm not sure where that's happening.)
There seems to be a bug here where, if the item is off-screen when
modified, it doesn't become visible, but it now does stay visible when
it's on-screen to begin with.
At least until we have a better interface for setting library-specific
sync settings
Previously, if My Library file syncing was disabled or set to WebDAV, My
Publications files wouldn't be uploaded.