Commit graph

4844 commits

Author SHA1 Message Date
Dan Stillman
88627adcdb Update linked attachment base directory code
- Replace nsIFile and persistent descriptors with OS.File and string paths
- Add tests for base dir settings
2015-09-29 04:42:12 -04:00
Dan Stillman
9e356a7e63 Migrate relative/persistent descriptors to string paths [DB reupgrade]
Absolute paths have been stored as strings on all platforms for a while,
but old Mac persistent descriptors (Base64-encoded opaque alias records)
could still exist in the DB. Additionally, relative paths for stored
files were stored as Mozilla-specific opaque strings rather than UTF-8
strings.

This adds a schema step to convert those to strings paths in the DB.
Since Mac persistent descriptors aren't converted if the file isn't
found, we still handle and (convert) old-style persistent descriptors if
necessary when reading paths from the DB.

This also moves path string handling -- converting a path to a prefixed
string for stored or base-dir-relative files -- to the
Zotero.Item#attachmentPath setter instead of save() so that reading it
back immediately returns the correct value. One consequence is that the
attachment link mode must now be set before setting the path.

Zotero.Item#getFile() is now deprecated in favor of getFilePath() and
getFilePathAsync() (which checks file existence).

Zotero.File.directoryContains() now takes string paths instead of files.
2015-09-29 04:42:08 -04:00
Dan Stillman
80008fd13d Pass tabIndex param to pref window to select tab within specified pane 2015-09-29 04:11:21 -04:00
Dan Stillman
d9b5e17c9c Asyncify Zotero.Attachments.getNumFiles() and add hasMultipleFiles()
Latter is probably all that's needed
2015-09-22 04:11:31 -04:00
Dan Stillman
fc1137b769 Asyncify Zotero.Attachments.getTotalFileSize() 2015-09-22 04:11:30 -04:00
Dan Stillman
2df630e83c Fix hang in sync tests from library version changes 2015-09-22 04:11:30 -04:00
Dan Stillman
0965079842 Use correct property in Zotero.Libraries.getVersion/setVersion() 2015-09-22 03:52:46 -04:00
Dan Stillman
add9481c63 Adjust error and feed tests for access error on read-only libraries 2015-09-22 03:52:31 -04:00
Aurimas Vinckevicius
0a88032715 ZU.capitalize should not throw for empty string 2015-09-21 17:08:23 -05:00
Aurimas Vinckevicius
d122323dbf Fix fullText tests on Windows 2015-09-21 17:08:22 -05:00
Aurimas Vinckevicius
88ab129ffb Add Feed and FeedItem
Also:
* _finalizeErase in Zotero.DataObject is now inheritable
* Call _initErase before starting a DB transaction
* removes Zotero.Libraries.add and Zotero.Libraries.remove (doesn't seem like this is used any more)
2015-09-21 17:08:21 -05:00
Aurimas Vinckevicius
74863843f4 Tweak varDump to not use object property getter unnecessarily 2015-09-21 02:28:09 -05:00
Aurimas Vinckevicius
0320b08b05 Do not return lastInsertRowID for INSERT, REPLACE, and CREATE
Unreliable for async queries
2015-09-21 02:28:09 -05:00
Aurimas Vinckevicius
6cef123662 Don't allow trashing items in read-only or "no trash" libraries 2015-09-21 02:27:53 -05:00
Aurimas Vinckevicius
e5a5a8d303 Don't allow erasing objects from read-only libraries 2015-09-21 02:27:53 -05:00
Aurimas Vinckevicius
1621f5772b Fix deleting collection with items 2015-09-18 03:34:04 -05:00
Aurimas Vinckevicius
07ca00edd5 Use _canHaveParent property to determine if object can have parent 2015-09-18 03:34:04 -05:00
Dan Stillman
b53892fe54 Fix various collection-dragging UI bugs
Fixes #823, hopefully
2015-08-08 17:26:42 -04:00
Dan Stillman
9fa53439ef Update hasChildCollections() when child moved to another collection 2015-08-08 16:45:51 -04:00
Dan Stillman
5a61ac4871 Don't try to select unselectable row on library tree row removal
(If deleting a group, don't select the header or separator before it.)
2015-08-07 16:36:53 -04:00
Dan Stillman
cbf4876173 Fix attachment renaming
Fixes #822
2015-08-07 15:36:46 -04:00
Dan Stillman
06867d886e Fix note loading 2015-08-06 22:49:21 -04:00
Dan Stillman
536cd867d7 Fix toJSON for attachment items 2015-08-06 15:55:37 -04:00
Dan Stillman
f963413170 Handle conflict resolution for remote item deletions 2015-08-06 06:03:45 -04:00
Dan Stillman
51253fb933 Delete from sync cache when deleting object 2015-08-06 05:25:45 -04:00
Dan Stillman
b5b99672db Remove some obsolete sync code 2015-08-06 04:19:53 -04:00
Dan Stillman
0aecaad761 Update conflict resolution for API syncing
This will appear much less frequently, since non-conflicting field changes on
both sides can be resolved automatically, but genuine field conflicts still
require manual conflict resolution.

The merge pane is no longer editable, since the itembox code to do that is
async and can't run in a modal window, but it's not really necessary,
particularly with conflicts happening less frequently.

TODO:

- Remote item deletions
- File conflicts
- Maybe handle some edge cases where the conflicted items fail to save
2015-08-06 04:14:49 -04:00
Dan Stillman
7075300a17 Fix hasChanged() bug related to 'synced' 2015-08-02 05:26:02 -04:00
Dan Stillman
f02a9aa95e Check remote delete log during full sync
If an object is marked as synced locally and doesn't exist remotely but
is in the remote delete log, delete it locally
2015-08-02 03:44:14 -04:00
Dan Stillman
67f4a467ea Consolidate object erase methods into DataObjects::erase() 2015-08-02 03:40:14 -04:00
Dan Stillman
4600318ad7 Support 'successful' property in upload response
Save uploaded data to cache, and update local object if necessary (which
it mostly shouldn't be except for invalid characters and HTML filtering
in notes)

Also add some upload and JSON tests
2015-08-01 05:28:42 -04:00
Dan Stillman
70d9b9870c Fix a few small data layer bugs, and tidy up a little
I don't think these were triggered by any client code, but I found them while
porting code to the server.
2015-07-31 04:09:24 -04:00
Andrew Dunning
e6d1f31e46 Supply missing Œ/œ in diacriticsRemovalMap. 2015-07-21 18:08:16 -04:00
Dan Stillman
a452af6c3a Sort descendant collections alphabetically in advanced search window
https://forums.zotero.org/discussion/50679/
2015-07-21 00:45:30 -04:00
Dan Stillman
984789d304 API syncing megacommit
There's a lot more to do, and this isn't ready for actual usage, but the
basic functionality is mostly in place and has decent test coverage. It
can successfully upgrade a library last used with classic syncing and
pull down changes via the API. Uploading mostly works but is currently
disabled for safety until it has better test coverage.

Downloaded JSON is first saved to a cache table, which is then used to
populate other tables and later for generating PATCH requests and
automatically resolving conflicts (since it shows what was changed
locally and what was changed remotely). Objects with unmet dependencies
or unknown fields are skipped for now but don't block the rest of the
sync.

Some of the bigger remaining to-dos:

- Tests for uploading
- Re-do the preferences to get an API key
- File sync integration
- Full-text syncing integration
- Manual conflict resolution (though this already includes much smarter
  conflict handling that automatically resolves many conflicts)
2015-07-20 18:16:57 -04:00
Dan Stillman
b4a8083f2f Throw specific errors for missing objects or unknown fields
And add a bit more debugging info to other messages
2015-07-20 17:31:27 -04:00
Dan Stillman
258b70b455 Throw an error saving an empty item with no item type 2015-07-20 04:15:27 -04:00
Dan Stillman
cd4d084dd9 Support for automatically merging collections and searches 2015-07-20 02:12:14 -04:00
Dan Stillman
9d0d79c9c2 Take a promise-returning function in Utilities.Internal.forEachChunkAsync()
Instead of a promise-yielding generator
2015-07-20 02:12:14 -04:00
Dan Stillman
4f55f28e7d Honor .synced on data objects in all cases
Previously, if .synced was already true, setting it to true and saving
would result in .synced == false unless skipSyncedUpdate was passed. Now
the value assigned to .synced is always used on the next save. If the
value hasn't changed and no other values have changed, a save will be a
no-op.
2015-07-20 02:12:14 -04:00
Dan Stillman
93b5694420 Make editable/filesEditable required in Zotero.Libraries.add() 2015-07-20 02:12:14 -04:00
Dan Stillman
6c536fc784 Don't create Quick Start Guide item for new libraries
The default items cause problems with conflict resolution for existing
users (and not syncing them or ignoring conflicts for them is kind of
weird), and they require remote changes for new databases. I do like
there not being a completely empty library, but I think it's probably
better just to display a virtual welcome message with a link to the
Quick Start Guide somewhere else, such as in the right-hand pane. (A new
installation also opens the start page on zotero.org.)
2015-07-20 02:12:13 -04:00
Dan Stillman
d868f007e9 Don't select new groups in collections pane 2015-07-20 02:12:01 -04:00
Dan Stillman
5c523d8694 Merge branch '4.0' 2015-07-18 07:09:53 -04:00
Dan Stillman
7c9d25dad8 Fix excessive file sync mtime updates/checks?
Same as 1c2b2575f, but this time in code we actually still run
2015-07-18 04:58:10 -04:00
Dan Stillman
6a687e8c40 Fix "filename too long" sync error for missing files on OS X/Linux 2015-07-17 18:23:59 -04:00
Dan Stillman
a97e27a9f2 Fix CSS in snapshots of Reader View
Allow saving of CSS links over chrome://. We can scope this to
chrome://global/skin/aboutReader.css if anyone thinks of a reason why
this was disabled to begin with, but I'm not sure in what other
situations CSS it would apply.
2015-07-17 16:22:15 -04:00
rmzelle
d3ab296cf5 Check single items in selection window 2015-07-15 21:21:51 -04:00
Simon Kornblith
2c5bfd5d5a Disable disabling by reverse lookup on non-Mac/Windows/Linux
If this is the case, it's probably a BSD derivative, but I can't
guarantee the code won't segfault.
2015-07-13 19:28:37 -04:00
Simon Kornblith
f856df5222 Fix #460 using OS APIs 2015-07-13 19:24:26 -04:00