Commit graph

282 commits

Author SHA1 Message Date
Dan Stillman
c5a9987f37 WebDAV file sync overhaul for 5.0
Also:

- Remove last-sync-time mechanism for both WebDAV and ZFS, since it can
  be determined by storage properties (mtime/md5) in data sync
- Add option to include synced storage properties in item toJSON()
  instead of local file properties
- Set "Fake-Server-Match" header in setHTTPResponse() test support
  function, which can be used for request count assertions -- see
  resetRequestCount() and assertRequestCount() in webdavTest.js
- Allow string (e.g., 'to_download') instead of constant in
  Zotero.Sync.Data.Local.setSyncState()
- Misc storage tweaks
2015-12-30 05:14:50 -05:00
Dan Stillman
8933e3b586 Item.toJSON() should output unset mtime/md5 as null, not undefined 2015-12-22 01:49:45 -05:00
Dan Stillman
cfee7ea9d2 Merge pull request #879 from adomasven/feature/transparent-api-keygen
Restores the functionality of 4.0 for sync settings
2015-12-14 19:28:56 -05:00
Adomas Venčkauskas
ffd9a07164 Restores sync credential functionality of 4.0.
Improves UX of sync authentication.
The account is now linked and unlinked and an API key related to
the client is generated transparently in the background.
The API key is deleted on unlinking.
No sync options are allowed before linking an account.
2015-12-14 23:55:28 +00:00
Adomas Venčkauskas
3fcfba5d36 Add sinon-as-promised for mocking promises 2015-12-14 23:05:54 +00:00
Dan Stillman
177dac3fd2 Closes #805, Translation shouldn't create new item in My Publications
And in download overlay, save and switch to My Library if My
Publications is selected.
2015-12-10 01:11:41 -05:00
Dan Stillman
e3033b056e Fix intermittent error in FullText.getUnsyncedContent() test 2015-12-09 04:51:48 -05:00
Dan Stillman
18349b2232 Restore certificate checking for API syncing errors
Closes #864

This adds a 'channel' property to Zotero.HTTP.UnexpectedStatusException,
because the 'channel' property of the XHR can be garbage-collected
before handling, and the channel's 'securityInfo' property is necessary
to detect certificate errors.
2015-12-09 04:11:27 -05:00
Dan Stillman
01fddc9bb9 Tweak DataObject::save() tests 2015-12-08 16:38:58 -05:00
Dan Stillman
08cb63f66d Fix various cases of saving items to selected collection
This changes Zotero.Translate.Base.translate() to take an options object (in
order to take a 'collections' parameter, which is passed to the
Zotero.Translate.ItemSaver constructor). The old parameters are still supported
with a deprecation warning, and there may be other places that still need to be
updated.
2015-11-15 17:49:31 -05:00
Dan Stillman
22b1fa8cf8 Don't load bundled files before each storageLocal test 2015-11-15 17:49:31 -05:00
Dan Stillman
57dfd1885d Allowing passing window to loadZoteroPane() support function 2015-11-15 17:49:31 -05:00
Dan Stillman
6d64526648 Ignore unknown fields in Zotero.Item::fromJSON() 2015-11-12 17:24:03 -05:00
Dan Stillman
563cfb4fd4 Add test PDF file 2015-11-12 15:40:42 -05:00
Dan Stillman
62aeb1da32 Full-text syncing support via API [DB reupgrade] 2015-11-12 02:54:51 -05:00
Dan Stillman
ae277391b6 Miscellaneous tweaks 2015-11-12 02:48:41 -05:00
Dan Stillman
bad9833896 Resolve caller.start() promise when passed functions finish
Instead of waiting for all queued functions to finish
2015-11-11 02:14:30 -05:00
Dan Stillman
3100f10396 Make Zotero.Libraries.getAll() return sorted Zotero.Library instances
My Library, My Publications, and then groups sorted by name
2015-11-04 14:04:21 -05:00
Dan Stillman
687ee6ba07 Fix sync error from items dragged between libraries before first sync
And fix bug in Zotero.URI.getURILibrary()
2015-11-02 20:36:47 -05:00
Dan Stillman
d07756d68d Store API key in login manager, and add temp field in prefs 2015-11-02 03:22:37 -05:00
Dan Stillman
7f43ca9503 Merge branch '4.0' 2015-11-01 21:22:13 -05:00
Dan Stillman
7e3ba7bc61 Misc. debug tweaks 2015-11-01 03:59:01 -05:00
Dan Stillman
1e6c29766f Add deletion uploading to API syncing [DB reupgrade]
Tags deletions are not currently synced, and maybe don't need to be.
2015-11-01 03:58:54 -05:00
Dan Stillman
6b8e5bafc6 Don't show deleted items outside of trash 2015-11-01 03:36:23 -05:00
Dan Stillman
532d485793 Delete older versions of processed objects in cache
And recover from "Sync cache had later version than remote" error, which
shouldn't actually happen...
2015-10-31 15:19:50 -04:00
Dan Stillman
c2ad4ceb0a Output 'deleted' as 1 instead of true in item JSON
Good idea? Not sure, but that's what the API does.
2015-10-30 19:07:12 -04:00
Dan Stillman
73f4d28ab2 ZFS file sync overhaul for API syncing
This mostly gets ZFS file syncing and file conflict resolution working
with the API sync process. WebDAV will need to be updated separately.

Known issues:

- File sync progress is temporarily gone
- File uploads can result in an unnecessary 412 loop on the next data
  sync
- This causes Firefox to crash on one of my computers during tests,
  which would be easier to debug if it produced a crash log.

Also:

- Adds httpd.js for use in tests when FakeXMLHttpRequest can't be used
  (e.g., saveURI()).
- Adds some additional test data files for attachment tests
2015-10-29 04:38:27 -04:00
Dan Stillman
76a37b4f9b Update maxVersion 2015-10-29 03:57:08 -04:00
Dan Stillman
0803bb84e3 Don't set collections: "" in PATCH JSON when changing item to child 2015-10-29 03:57:08 -04:00
Dan Stillman
5c32962bb1 Add test for Zotero.Utilities.Internal.md5Async() 2015-10-29 03:57:08 -04:00
Dan Stillman
ae69fbbd9b Disable Firefox extension signature checking during tests 2015-10-29 03:57:04 -04:00
Dan Stillman
ee6793a9e6 ConcurrentCaller changes
- Different constructor parameters
- id property for logging
- fcall() -> start()
- add() to enqueue without starting
- runAll() to run down queue and return promises for all current tasks
- wait() to wait for all running tasks to finish
2015-10-29 02:57:42 -04:00
Dan Stillman
62e586073d concurrent-caller.js -> concurrentCaller.js 2015-10-29 02:49:31 -04:00
Dan Stillman
7d8a1b2573 Make Zotero.DataObject#fromJSON() synchronous
When called on an identified object (i.e., one with an id or
library/key), loadAllData() must be called first. When called on a new
object (which is more common anyway), fromJSON() can be called
immediately.
2015-10-29 01:19:14 -04:00
Dan Stillman
2b8a5ba0b7 Disable extension signing check for test runs 2015-10-26 05:00:38 -04:00
Dan Stillman
493d37d1c7 Fix 100% CPU usage with pane open (since 9e356a7e6)
And make Zotero.Item.prototype.fileExists() check the file regardless of
whether there's a cached state.
2015-10-12 23:08:02 -04:00
Dan Stillman
1b333be23f Add Zotero.Library.prototype.lastStorageSync 2015-09-29 04:42:13 -04:00
Dan Stillman
691819bd32 Add Zotero.Library.prototype.libraryTypeID
Get the library-type-specific id for the library (e.g., userID for user
library, groupID for group library)
2015-09-29 04:42:13 -04:00
Dan Stillman
4b83d157b9 Add "use strict"; to test file 2015-09-29 04:42:13 -04:00
Dan Stillman
7633c7de30 Set test timeout in resetDB() instead of separate this.timeout() calls
'thisArg: this' should be passed to resetDB to have it adjust the
timeout
2015-09-29 04:42:12 -04:00
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
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
add9481c63 Adjust error and feed tests for access error on read-only libraries 2015-09-22 03:52:31 -04:00
Aurimas Vinckevicius
995bc9667b Open a window for syncRunner tests
For some reason setTimeout in waitForWindow sometimes does not fire without a window open.
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
38b9bbc8c8 Fix Translate tests on Windows 2015-09-21 17:08:22 -05:00
Aurimas Vinckevicius
8900a83b7d Fix Zotero.DataObject.key test 2015-09-21 17:08:21 -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