Commit graph

1029 commits

Author SHA1 Message Date
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
9202ab8b3c Download missing attachments as needed even in at-sync-time mode 2017-08-11 16:06:06 +02:00
Dan Stillman
678a6e15cc Better Unicode path comparison in WebDAV.purgeOrphanedStorageFiles() 2017-08-10 04:41:16 +02:00
Dan Stillman
8b7f33826e Fix sync test after 7b0ed6da81 2017-08-05 01:41:21 +02:00
Dan Stillman
c110e64293 Consider fulltextItems with SYNC_STATE_MISSING as unindexed
The items will still match full-text word searches, but they won't match
phrase searches (because those require cache files for non-text
attachments) and the full-text won't sync to other computers, so they
should really be reindexed.
2017-07-26 22:16:01 -04:00
Dan Stillman
67ccb632b4 Don't keep looking for unsynced full-text content that isn't available
This can happen if cache files are deleted for PDF attachments or if
text files are missing.
2017-07-26 22:16:01 -04:00
Dan Stillman
61f8a2c3c5 Fix various problems with fulltextContent searches
Including finding items in the wrong library and not finding any items
when paired with the checkboxes in ANY mode
2017-07-26 22:16:01 -04:00
Dan Stillman
46531a4c69 Remove non-matching parent items when deleting items from trash
Fixes #866, Trash doesn't refresh properly when emptying deleted
attachments
2017-07-26 22:16:01 -04:00
Dan Stillman
c2234176aa Disable debug output logging test for now
This should be tested, but we run tests in Firefox, and this doesn't
exist in Firefox... Easiest option is probably to add the submenu to the
Firefox menus for the purposes of testing.
2017-07-25 03:29:41 -04:00
Dan Stillman
225215842d Fix auto-syncing of unchecked groups after object change 2017-07-21 19:39:37 -04:00
Dan Stillman
6d2c72fb54 Fix revealing parent directory of missing file
Updates Zotero.File.getClosestDirectory() to take a path rather than an
nsIFile
2017-07-21 18:33:36 -04:00
Dan Stillman
316a6f91b2 Test for tag selector search 2017-07-20 18:25:12 -04:00
Adomas Venčkauskas
84c1367e7b Adjust connector server test for ece3491e2 2017-07-19 11:55:46 +03:00
Dan Stillman
cd35962435 Fix Quick Copy tests after 6d265f448f 2017-07-19 04:36:45 -04:00
Dan Stillman
ef7da3486a New state-handling approach for item tag changes
If this works out I think we'll want to use this approach for
all data layer changes.

Previously, an unsaved change on an object would update its state
immediately, which was fine for synchronous code but breaks down if a
save involves multiple asynchronous calls, because modifying state after
the relevant data has been saved to the DB but before the `_changed`
object has been cleared would mean that new changes would be lost. Now,
changes are written to _changedData, and a get for the data first checks
_changedData before checking the state property (e.g., _tags) directly.
The changedData property is cleared as it's written, and once the object
is saved, the reload updates the state property with the new data.
2017-07-18 17:31:40 -04:00
Dan Stillman
e683b2be07 Fix a potential sync error with child attachments
If a standalone attachment existed in a collection and then was added to
a parent (e.g., via Create Parent Item), and attachment metadata was
also changed at the same time (e.g., due to file syncing), the
'collection item must be top level' trigger could throw on another
syncing computer. To work around this, remove collections first, then
make changes to the parentItemID columns, and then add new collections.
2017-07-11 02:35:11 -04:00
Dan Stillman
de3b47fd78 Add "Delete Automatic Tags in This Library…" option to tag selector menu
I think it might be worth having a tag management window that lets you
view tags as a grid, sort by column (e.g., type), select ranges, delete,
consolidate, etc., but until then, this fulfills a popular request.
2017-07-07 18:19:12 -04:00
Dan Stillman
f7c1c56d7d Use 'async' configOptions property to indicate promisified translators
Instead of >"2017-07-05"

Addresses https://github.com/zotero/translators/issues/1353
2017-07-05 15:29:13 -04:00
Dan Stillman
198bd70b59 Make 909b4b31c8 apply to search translators too, and fix tests
Addresses https://github.com/zotero/translators/issues/1353
2017-07-05 09:15:12 -04:00
Dan Stillman
88088c68db Add Sync.Storage.Local.updateSyncStates()
This speeds up updating of sync states, particularly after resetting
file sync history.
2017-07-01 06:31:46 -04:00
Dan Stillman
9a3ff2d244 Add .contentType and .charset options for importFromFile()
And use them in new importTextAttachment() and importHTMLAttachment()
test support functions. These can be used to avoid needing a hidden
browser for determining the character set of the imported text
documents.
2017-07-01 06:31:46 -04:00
Dan Stillman
b1fad5a310 Automatically run JS build process before tests if not running 2017-07-01 06:31:46 -04:00
Dan Stillman
22eab3e09d Don't leave file descriptor open in md5Async()
This could cause "Too many open files" errors during file syncing
2017-06-30 17:54:33 -04:00
Dan Stillman
e89778c1ab Remove some code that's unnecessary now that we're Fx52+ everywhere 2017-06-23 05:03:11 -04:00
Dan Stillman
c11f1069d7 Add -e flag to runtests.sh to stop tests after a given file
This is useful when trying to debug an error that only happens after a
number of other tests have run -- specify -e and run tests from either
an earlier file with -s or from the beginning.
2017-06-20 05:48:38 -04:00
Dan Stillman
7c020da594 Don't run feeds update until after schema update promise
And tweak feed scheduling in general
2017-06-19 01:25:03 -04:00
Dan Stillman
26145c3892 Additional prefs in tests to bypass Telemetry prompt 2017-06-19 00:42:31 -04:00
Dan Stillman
1a0f125d78 Maybe fix browser test failures by preloading translators 2017-06-19 00:40:52 -04: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
859c506913 Never auto-select new groups, since they always come from syncs
Fixes test failure from 2e74cd7831
2017-06-16 05:59:44 -04:00
Dan Stillman
69041832e7 Remove Zotero_Browser tests for new Firefox windows
I'm not sure if we need the browser tests at all -- we still translate
some things via hidden browsers, and I'm not sure what we have that
tests that -- but we definitely don't need to test saving before the
Zotero pane is opened.
2017-06-16 04:55:29 -04:00
Dan Stillman
4032edcf7d Ignore note markup conflicts without cache when text content matches 2017-06-14 03:37:03 -04:00
Dan Stillman
3ebc238320 Close prefs window after WebDAV Verify Server tests 2017-06-14 03:37:03 -04:00
Dan Stillman
ccb30351c0 Fix incorrect purging of files on WebDAV 2017-06-14 03:20:23 -04:00
Adomas Venčkauskas
a17b486e4b Don't auto-migrate data dir if target on a different drive
See https://forums.zotero.org/discussion/comment/277632/#Comment_277632
2017-06-13 17:17:34 -04:00
Dan Stillman
98f1ac5edb Merge pull request #1240 from tnajdek/master
Tweaks to make build work on Windows
2017-06-06 02:18:45 -04:00
Dan Stillman
cd6079d869 Relax last-sync-time check in sync runner test 2017-06-06 02:14:23 -04:00
Tom Najdek
e86bbfbda0 Tweak test runner to work in MSYS environment on Windows 2017-06-06 00:36:03 -04:00
Dan Stillman
b79ecfb5fe Temporarily disable test for non-integer getAsync() 2017-06-05 03:00:15 -04:00
Dan Stillman
898a1dc679 Add alternative to padStart for test in Fx45 2017-06-01 16:44:11 -04:00
Dan Stillman
05ff16c17f Fix some breakage from 013dc958b3 2017-06-01 15:39:42 -04:00
Dan Stillman
ede03f4366 Update some Sinon reset() calls
In Sinon 2, reset() now resets both behavior and history, so if a stub
specifies behavior and we want to use it again, we have to call
resetHistory().
2017-06-01 15:39:42 -04:00
Tom Najdek
a59b78e59e Tweak test syntax that breaks with current version of chai-as-promised
* Second parameter should be an optional message, however is treated
  as a string that should be contained in the error message
2017-06-01 11:36:18 -04:00
Tom Najdek
4ec6925220 Remove "Error:" expected in error messages.
* "Error:" seems to have been injected into the message by Bluebird,
  but that's no longer the case
2017-06-01 11:36:18 -04:00
Tom Najdek
063e13ef22 Modernize sinon.stub() calls 2017-06-01 11:36:17 -04:00
Tom Najdek
289b049377 Support generators in tests via coMocha, instead of custom code
* coMocha offers better error stack trace
2017-06-01 11:36:17 -04:00
Tom Najdek
14bf3184bb Fixes and tweaks to make tests work with babelized code
* Use mocha, chai & sinon from the npm. As of sinon 2.0
  sinon-as-promised is no longer required so it is removed
* Tweak code to re-use the same loader with the same environment
  throghout the code
* Introduce browserify step for testing tools that only provide
  node-compatible libraries (sinon, chai-as-promised)
* Introduce copy step for test data to resolve multiple issues with
  tests depending on files not being symlinks
* Re-introduce custom implementation of setTimeout to resolve issues
  with few tests
* Re-introduce custom Bluebird Promises config & monkey patch
2017-06-01 11:36:16 -04:00
Dan Stillman
748c30206f Run tests from build dir 2017-06-01 11:36:16 -04:00
Dan Stillman
1e459287de Convert non-standard octal escape sequences to hex in test runner 2017-05-24 01:59:56 -04:00
Dan Stillman
c0f7f6070a Avoid a warning from a storageRequest test from the item not existing 2017-05-23 02:12:00 -04:00
Dan Stillman
e1fb28faa9 Convert some object ids from strings to integers after 4e1937680 2017-05-23 02:10:26 -04:00
Dan Stillman
265df6d48c Skip edit check if skipAll is passed to object save 2017-05-22 17:29:56 -04:00
Dan Stillman
1b8704f133 Firefox 54 compatibility: File.createFromFileName() returns a promise 2017-05-22 06:04:27 -04:00
Dan Stillman
a3eea03a38 Firefox 54 compatibility: rename "new" and "delete" XBL methods 2017-05-22 06:03:14 -04:00
Dan Stillman
fc4eb5308f Remove related-item relations when deleting item 2017-05-19 12:11:51 -04:00
Dan Stillman
90a27f8d4b Add Zotero.URI.getURIItemLibraryKeyFromDB()
Allows getting libraryID and key without relying on library data being
loaded (e.g., at startup)
2017-05-19 12:11:21 -04:00
Dan Stillman
f12ae67c47 Test for e1986b460e (export with empty attachment path) 2017-05-14 05:26:39 -04:00
Dan Stillman
20121b9b97 Fix tag selector tests (broken in 5963c02db) 2017-05-12 06:13:02 -04:00
Dan Stillman
5963c02dbb Fix "Display All Tags in This Library" (broken in fe186333b) 2017-05-12 05:37:46 -04:00
Dan Stillman
60810ea0a0 Fix access date without time coming from sync 2017-05-11 00:44:37 -04:00
Dan Stillman
12e70460dc Load polyfill in tests for Object.values() support in Fx45 2017-05-08 18:48:11 -04:00
Adomas Venčkauskas
dbeecb9b0a Make itemFromCSLJSON independent of Zotero.Item existance.
Addresses !zotero/zotero-connectors#121"
2017-05-08 09:24:34 +03:00
Dan Stillman
e0e22225bc Fix entering date without time into Accessed
https://forums.zotero.org/discussion/65560/5-0-beta-accessed-field-changes-dates
2017-05-05 17:59:53 -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
2eef1702e0 Prevent items in group libraries from being added to My Publications
And remove existing group items that have been added
2017-05-04 21:18:44 -04:00
Adomas Venčkauskas
37fa0c203f Write sessionID into the doc on new session creation 2017-05-03 14:34:00 +03:00
Adomas Ven
7d79865023 Merge pull request #1222 from adomasven/feature/document-preferences-cleanup
Document preferences cleanup
2017-05-03 13:09:49 +03:00
Dan Stillman
5b0b874435 Purge old objects in sync cache after upload 2017-05-03 03:43:59 -04:00
Dan Stillman
aa1fc01b31 Fix syncing of related item removal 2017-05-02 20:15:54 -04:00
Adomas Venčkauskas
3c19bbffe4 Remove store references in document option. Closes #1216 2017-05-02 16:29:19 +03:00
Adomas Venčkauskas
5e3c7bf63d Fix test breakage from a76493f60 2017-05-02 15:09:12 +03:00
Dan Stillman
32b1769f2f integrationTests.js -> integrationTest.js 2017-04-28 04:12:19 -04:00
Dan Stillman
fe88530120 Recover from a remotely missing parent collection 2017-04-28 03:18:50 -04:00
Dan Stillman
9bd01af2a5 Disallow inPublications for linked-file attachments 2017-04-27 15:33:24 -04:00
Dan Stillman
d715197b2f Don't show Show/Hide button in My Publications for linked files 2017-04-27 04:52:50 -04:00
Dan Stillman
d527c340c6 Fix "text is not defined" error during full-text content sync 2017-04-26 02:44:01 -04:00
Adomas Venčkauskas
bbec11e3eb Prepare 5.0 to handle JSON doc prefs 2017-04-20 18:03:15 +03:00
Adomas Venčkauskas
e272465f6c Fix DocumentData serialization hairiness due to #htmlSpecialChars
Add tests
2017-04-20 13:39:19 +03:00
Dan Stillman
de7b56b8a1 Don't include items in My Publications in Unfiled Items 2017-04-17 21:34:08 -04:00
Dan Stillman
b3277de5ae Update tests after citeproc-js upgrade to match output 2017-04-15 04:35:16 -04:00
Dan Stillman
e397d12d42 Update whitespace chars in cleanISBN/cleanISSN tests for Firefox 52+
Farewell, Mongolian Vowel Separator
2017-04-14 23:14:22 -04:00
Adomas Venčkauskas
49001572fd Remove dependency on zoteroIntegration.idl 2017-04-14 14:19:52 +03:00
Adomas Venčkauskas
0de22b132e Move document plugin interface description into integrationTests 2017-04-14 14:19:52 +03:00
Dan Stillman
9c91018964 Reduce indentation in waitForWindow() support function 2017-04-13 05:51:52 -04:00
Dan Stillman
6d18b46165 Fix test breakage after 5ff2a59f87
And remove all instances of `publicationsLibraryID`
2017-04-13 00:15:05 -04:00
Dan Stillman
5ff2a59f87 Move My Publications into My Library
Instead of My Publications being a separate library, have it be a
special collection inside My Library. Top-level items can be dragged
into it as before, and child items can be toggled off and on with a
button in the item pane. Newly added child items won't be shown by
default.

For upgraders, items in the My Publications library will be moved into
My Library, which might result in their being duplicated if the items
weren't removed from My Library. The client will then upload those new
items into My Library.

The API endpoint will continue to show items in the separate My
Publications library until My Publications items are added to My
Library, so the profile page will continue to show them.
2017-04-12 19:26:58 -04:00
Dan Stillman
4da0c4c1fc Remove unused laststoragesync response from test 2017-04-12 05:37:15 -04:00
Adomas Venčkauskas
7657c9044d Add Document.addEditBibliography to integration.js
See zotero/zotero-word-for-windows-integration#28 for background
2017-04-12 11:59:38 +03:00
Adomas Ven
2a5dbaa204 Merge pull request #1202 from adomasven/fix/doc-pref-window-unloaded-styles
Fix document preferences dialog failing when styles unloaded.
2017-04-12 11:52:58 +03:00
Adomas Venčkauskas
ea535bceb0 Add tests for style from untrusted source prompt 2017-04-12 11:48:06 +03:00
Adomas Venčkauskas
02c43c3643 Add integrationTests.js
Contains a dummy doc plugin, which is useful for:
- Testing integration.js functionality
- Serving as succint documentation for development of new integration
  plugins
2017-04-12 11:45:10 +03:00
Dan Stillman
5d6478e507 429 and Retry-After support for API requests 2017-04-11 04:17:16 -04:00
Adomas Venčkauskas
269a250b4f Fetch a style if it is not installed on document preferences load 2017-04-10 11:24:22 +03: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
c43823ad60 Maybe fix noteeditor test failures for real 2017-04-01 14:29:45 -04:00
Dan Stillman
7609ef35bc Allow setting note text with createDataObject('item') test function 2017-04-01 14:28:32 -04:00
Dan Stillman
bb489a45c3 Upload modified items after tag rename
The web library will probably still display the old tag in addition to
the new one, at least until browser restart. We'll have to deal with
that separately.

Closes #1205
2017-04-01 02:54:24 -04:00
Dan Stillman
09d4960e1f Increase timeout to hopefully prevent noteeditor tag test from failing 2017-03-27 20:46:25 -04:00
Dan Stillman
3a8357cb95 Fix renaming and clearing of colored tags 2017-03-27 20:46:25 -04:00
Dan Stillman
fe186333be Drastically speed up tag selector refresh with many tags
When refreshing, if fewer than 100 tags to show, just create them from
scratch instead of updating the full set. Otherwise, remove the full set
from DOM and add it back in after updates to avoid reflows (from #1204).

There are various things that could be done to optimize this further
(avoiding unnecessary sorting during full refreshes, calculating a hash
of the full set and not updating it every time), but we should probably
just replace it with @tnajdek's React version first.

Closes #1204
2017-03-27 20:45:22 -04:00
Dan Stillman
edb53c31df Fix updating of tag selector after filtering the middle pane
Adds a 'refresh' event to libraryTreeView
2017-03-24 05:37:41 -04:00
Dan Stillman
820755e152 Rework libraryTreeView event handling
Changes `libraryTreeView::addEventListener('load')` and similar to
`libraryTreeView::onLoad.addListener(listener, once)`, etc. `once` is an
optional boolean that, when true, causes the listener to fire once and
then be removed. This is implicit for 'load'.

'load' maintains its special behavior of running immediately if the
treeview has already been loaded.

Also adds `waitForLoad()` and `waitForSelect()` functions that return
promises on event completion, since most uses of those events were just
resolving deferreds.
2017-03-24 05:23:56 -04:00
Dan Stillman
1a4b7121d3 Move waitForTagSelector() into support.js 2017-03-24 00:51:25 -04:00
Dan Stillman
a3473896a5 Fix error showing some WebDAV verification errors 2017-03-13 16:02:34 -07:00
Dan Stillman
640aaa1557 Add loadPrefPane(paneName) support function
E.g., loadPrefPane('sync') to open the prefs and select the
'zotero-pane-sync' pane
2017-03-13 16:02:34 -07:00
Dan Stillman
e9fd7f2dd1 Update Collection::getChildItems() when erasing item
Fixes #1188
2017-03-07 01:54:49 -05:00
Dan Stillman
9e59500619 Fix file sync error on Windows for old filenames containing colons
OS.Path.basename() stops at colons on Windows, so calling it on the full
path produces unexpected results.
2017-03-06 22:04:56 -05:00
Dan Stillman
1b81004a93 Remove errant HTML tag 2017-03-03 16:40:28 -05:00
Dan Stillman
fe9fc8bc5a Asyncify various functions to fix cross-library drag-and-drop error
When dragging an item to another library, we have to check if there's a
linked item in the target library, but items might not yet be laoded in
the other library, so item.getLinkedItem() can fail with "Item [n] not
yet loaded].

Fixing required asyncifying the follow functions:

- Zotero.Item::getLinkedItem()
- Zotero.Collection::getLinkedCollection()
- Zotero.URI.getURIItem()
- Zotero.URI.getURICollection()
- Various integration functions
2017-03-03 16:40:28 -05:00
Dan Stillman
7c25093ca2 Fix various error propagation issues during translation
As noted in 27cb099c82, import translators should be rewritten to return
a promise from doImport() and wait for promises from successive
item.complete() calls. They should then be marked as minVersion: "5.0"
to be handled properly by this new code.

(But this tries to account, albeit with somewhat worse behavior, for
translators that haven't been rewritten and sandboxes without Promise
(which is currently the case with child sandboxes in the client).)

(Oh, and I haven't tested this at all in the connectors.)
2017-03-03 04:51:01 -05:00
Dan Stillman
7ccf781add Firefox 52 compatibility 2017-03-02 15:30:54 -05:00
Dan Stillman
0d8643087a Update relations using local user key when first setting sync user
In case items are merged before the first sync
2017-03-01 23:38:45 -05:00
Dan Stillman
ba91a2ea52 Fix updating of notes list when child note is changed or moved to trash 2017-03-01 01:39:39 -05:00
Dan Stillman
6c58389563 Fix translation error when firstName is null for fieldMode 1
Some translators (e.g., CrossRef) return firstName: null with fieldMode:
1, which was causing an error
2017-02-27 23:34:16 -05:00
Dan Stillman
a35d903e77 Increase size of browser window during tests
Makes it easier to manually increase Zotero pane before a timeout while
debugging (though the page should just be made bigger by default)
2017-02-27 04:54:11 -05:00
Dan Stillman
d0a1ac9677 Fix potential incorrect placement of new subcollections
For one particular complicated collection structure, new collections
could be placed in the wrong place until a restart.
2017-02-27 04:51:04 -05:00
Dan Stillman
18877a9748 Additional test for updateSynced()
Addresses #1187
2017-02-27 03:11:09 -05:00
Dan Stillman
cb5e1fa431 Handle paginated results in Zotero.Sync.APIClient.getGroups() 2017-02-24 18:41:37 -05:00
Dan Stillman
57626101ac Fix incorrect tests due to the bug fixed in b21729edd1 2017-02-24 03:50:31 -05:00
Dan Stillman
3ba2b40c4c Remove obsolete Zotero.Libraries.isFilesEditable test after 88184b341 2017-02-24 03:29:50 -05:00
Dan Stillman
80a0826eb6 Add archived group handling to sync runner
- Archive remotely missing that user chooses to keep
- Ignore archived groups that don't existing remotely
- Unarchive groups that become available again
2017-02-24 02:36:18 -05:00
Dan Stillman
9ac458e05c Add 'archived' property to Zotero.Library objects
Set when a user loses access to a library but chooses to keep it as a
read-only library.
2017-02-24 02:36:18 -05:00
Dan Stillman
88184b341b Setting a library's 'editable' to false should do same for 'filesEditable' 2017-02-24 02:36:18 -05:00
Dan Stillman
74d1cc193a Check database values in Zotero.Library#editable tests 2017-02-24 02:36:18 -05:00
Dan Stillman
f7074a75b5 Fix error deleting selected library 2017-02-24 02:36:17 -05:00
Dan Stillman
383eac4657 Use same directory for OS.File.moveAtomic() temp file
Using the main temp directory was causing writes to fail when storage
was on another filesystem.
2017-02-22 19:53:48 -05:00
Dan Stillman
0964277a37 Use OS.File.move() for data-dir migration on Windows, and make automatic
Previously on Windows, where we don't have /bin/mv, we were recursing
into the data directory and copying files individually, which is very
slow, so automatic migration was disabled. Instead, try moving
directories with OS.File.move() with the `noCopy` flag. Moving
directories is technically unsupported by OS.File, but probably only
because of the possibility of a cross-volume copy (which is only
implemented for some platforms), and using `noCopy` hopefully prevents
that. If someone does have their data directory or storage directory on
a different volume, the migration might be quite slow, but leaving a
data directory behind in the Firefox profile directory (where it can be
easily misplaced with a seemingly unrelated Firefox reset) is worse.
2017-02-22 04:56:49 -05:00
Dan Stillman
3c5912f68d Merge pull request #1180 from adomasven/fix/savePage-no-translator 2017-02-21 16:40:33 -05:00
Adomas Venčkauskas
01df8f59e5 Default to first translator for /connector/savePage if not provided 2017-02-21 16:40:10 -05:00
Dan Stillman
333675d8ea Don't select sibling on attachment removal if attachment was unselected
Fixes #1173
2017-02-21 01:21:07 -05:00
Dan Stillman
60b2e16746 Fix "Item collection [n] not found" error after deleting collection 2017-02-21 00:38:00 -05:00
Dan Stillman
64d73cf2d0 Fix handling of old-style 'condition'/'savedSearch' conditions
Strip library id prefix in addCondition() and _loadConditions(), so the
internal code can always expect just a key.
2017-02-21 00:04:53 -05:00
Dan Stillman
d32f23471e Fix setting of libraryID in createDataObject() support function
When another property was also set, setting libraryID would fail.
2017-02-21 00:04:53 -05:00
Dan Stillman
5c50bb00cf Don't save full-text cache files for linked files to linked directory
Regression from 80f888f374. Not entirely sure what I was trying to fix there.
2017-02-20 17:51:37 -05:00
Dan Stillman
bb0fa73899 Fix old-style 'collection' condition for My Library in saved searches 2017-02-18 14:19:30 -05:00
Dan Stillman
07ea9dae84 Merge pull request #1172 from adomasven/fix/clean-authors
Get a better last name if current guess starts with weird symbols
2017-02-18 12:52:45 -05:00
Adomas Venčkauskas
bf1c52a5fd Get a better last name if current guess starts with weird symbols 2017-02-18 18:12:24 +01:00
Dan Stillman
058a4b1593 On 404 from ZFS upload, mark attachment item for upload
This shouldn't happen, but reported here:

https://forums.zotero.org/discussion/64386/5-0-beta-persistent-sync-errors

Possibly the same cause as this:

https://forums.zotero.org/discussion/64438/5-0-beta-persistent-sync-error
2017-02-16 20:11:05 -05: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
bb665a56b6 Fix firstCreator for unsaved items
Necessary when editing embedded citations that don't exist in library
2017-02-15 23:15:00 -05:00
Dan Stillman
3830aa1125 Mark trashed items as unsynced and update parents (including note list)
Regression from 3a0e0cb088
2017-02-15 14:22:34 -05:00
Dan Stillman
0570c2edc7 Fix test failure after 27cb099c82
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.
2017-02-09 02:29:24 -05:00
Dan Stillman
3a0e0cb088 Drastically speed up moving items to the trash
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.
2017-02-08 23:42:55 -05:00
Dan Stillman
12ad749087 Fix additional file sync error with no remote stored hash
Follow-up to c9694e93b0
2017-02-08 14:12:16 -05:00
Dan Stillman
55e9a0ee35 Update empty state of parent collection when deleting subcollection 2017-02-03 01:18:00 -05:00
Dan Stillman
1a49018bdc Fix moving items between collections
`mozSourceNode` seems to no longer be set in `dataTransfer` objects
during drags, so we now store it in `Zotero.DragDrop`.
2017-02-03 00:07:16 -05:00
Dan Stillman
f98de97e4d Don't select last item in list when item is removed from collection 2017-02-03 00:07:16 -05:00
Dan Stillman
48a81e3b46 Fix 412 after choosing local file on file conflict 2017-01-29 07:50:46 -05:00
Dan Stillman
4d56191f0c Fix importing of files using relative paths 2017-01-27 20:51:12 -05:00
Dan Stillman
aec9b2a531 Automatically use remote version when two items in trash are in conflict 2017-01-26 18:07:01 -05:00
Dan Stillman
e23452363b Handle auto-hyphenated ISBN during item conflict
Always keep the hyphenated version, and don't consider it a visible conflict
2017-01-26 15:08:34 -05:00
Dan Stillman
a43f9d16ac Allow number or name for translator type in buildDummyTranslator()
This reverts c6b78da69d, which changed it to expect numbers when I
noticed the type being undefined in debug output, but apparently the
only tests where the type actually mattered passed it as a name.

At some point we should just change all tests to pass as a name.
2017-01-23 09:13:44 -05:00
Dan Stillman
c6b78da69d Fix translatorType in dummy translators in tests 2017-01-23 07:02:08 -05:00
Dan Stillman
c9694e93b0 Fix file upload error when remote attachment has no stored hash 2017-01-22 15:30:18 -05:00
Dan Stillman
90a3013802 Disable script run time warning in tests 2017-01-21 06:37:44 -05:00
Dan Stillman
9b247ebba7 Fix error trying to generate report for many items
When adding many search conditions (e.g., when matching many items with the
`key` condition), the query can fail due to either the bound parameter limit or
the expression tree size limit.

To avoid this, add support for an 'inlineFilter' property on search conditions
when using the 'is' or 'isNot' operator. 'inlineFilter' is a function that
returns a quoted value suitable for direct embedding in the SQL statement, or
false if not valid. Multiple consecutive conditions for the same 'inlineFilter'
field are combined into an `IN (x, y, z)` condition.
2017-01-21 03:38:36 -05:00
Dan Stillman
362e18c747 Fix attachment content search
And always convert ids from GROUP_CONCAT() to integers in search code.
2017-01-19 13:32:29 -05:00
Dan Stillman
2237c71dcb Fix test for invalid id passed to DataObjects.getAsync() 2017-01-17 04:18:39 -05:00
Dan Stillman
a017fe6666 Fix Zotero.Date methods within translator sandbox
Only a few methods are imported, so some of the changes in 7bdcc17ed
have to be reverted.
2017-01-17 02:23:15 -05:00
gracile-fr
695cb9583a Amend short form of French months (continuing #64)
The Firefox French language pack contains some mistakes regarding
the short form of months. As a consequence, French month parsing
didn't work.

Please note that these values aren't even the correct abbreviations
but only the three or four first letters of the correct abbreviations.
See the French CSL locale for the correct abbreviations.
2017-01-16 18:58:59 +01:00
Dan Stillman
f2440eb826 Fix passing file: URI to Zotero.File.getContentsAsync() 2017-01-14 17:20:39 -05:00
Dan Stillman
ef1ff8bc42 Fix #64, Non-English month parsing doesn't work in Standalone
Month values from the Firefox language packs are included in a
JSON file used by `Zotero.Date.getMonths()`. `getMonths(true)` includes
English months as well.

The JSON file should be bundled with the connectors as well, and
Zotero.Date.init() should be updated to populate the month data from
that.
2017-01-09 04:47:23 -05:00
Dan Stillman
a076edc836 Update some deprecated function calls 2016-12-29 21:50:33 -05:00
Dan Stillman
9ffab20a09 Add option to Zotero.Utilities.ellipsize() to truncate at word boundary 2016-12-29 04:01:00 -05:00
Dan Stillman
ab959cd858 Fix "Reset File Sync History" 2016-12-22 10:00:40 -05:00
Dan Stillman
a9a54ed21c Set API URL via pref for download-on-demand test 2016-12-21 08:23:31 -05:00
Dan Stillman
205bab7b89 Fix Travis failure after skipped test
Apparently after() is run even if a test is skipped
2016-12-21 05:28:48 -05:00
Dan Stillman
4b602ed26c Disable all recognizePDF tests in Travis 2016-12-18 09:18:57 -05:00
Dan Stillman
6994c63a0e Tweak recognizePDF fix, add test coverage, and enable manual tests
Still disabled in Travis until we mock the remote services
2016-12-17 08:05:33 -05:00
Dan Stillman
238ab80699 Add -s flag to runtests.sh to start at given file
Useful for restarting after spurious errors when using -f

E.g., ./runtests.sh -s syncEngine
2016-12-16 04:21:37 -05:00
Dan Stillman
7447525d75 Remove test for moving existing target dir during data dir migration
Functionality removed in 0be67dbda5
2016-12-14 03:36:35 -05:00
Adomas Ven
d6d4e4b33e Saner feed database management (#1131)
* Mark feedItems read in a single batch SQL update
* Automatically remove old feed items
* User-facing preference globally and per-feed for feed item expiration
2016-12-13 09:07:43 -05:00
Dan Stillman
7fc352b9b7 Fix "Add Item by Identifier" (broken by 78b1d2ee3)
And make lookup tests run when not on Travis, though we should still mock the
HTTP requests.
2016-12-13 05:23:21 -05:00
Adomas Ven
747c11c917 Improves proxy support (#1129)
Improves proxy support

- Automatically detect and dehyphenise https proxies which use EZProxy
  HttpsHyphens
- Web translators now pass around Zotero.Proxy instances which can
  proxify/deproxify urls passed to `translate.setLocation()` before calling
  `translate.getTranslators()`/ translate.detect()`. The proxy passing is
  done within connector background/injected processes and between
  standalone and connectors.
- Proxy protocol unified with connectors. Connectors can now pass
  proxies to `/connector/save_items`. The proxies will be used to resolve
  true item and attachment urls when saving.

Closes zotero/zotero#578, zotero/zotero#721

Relevant zotero/zotero#34, zotero/zotero#556
2016-12-12 14:29:59 +02:00
Dan Stillman
80f888f374 Fix replacement of existing item storage directories
- Make Zotero.Attachments.createDirectoryForItem() delete existing
  directory instead of moving it to orphaned-files; also now returns a
  string path instead of an nsIFile
- Use above function during file sync instead of
  _deleteExistingAttachmentFiles(), which was partly broken
- Fix throwing on errors when saving some attachment types
2016-12-12 04:06:01 -05:00
Dan Stillman
85776a99b2 Fix test 2016-12-11 02:55:47 -05:00
Dan Stillman
78b1d2ee35 Import translation improvements
- Don't block the UI with a progress meter during imports. Instead, show
  a popup in the bottom right when the import is done that shows how
  many items were saved.
- Fix hang when importing some files
- Fix various problems with asynchronous operations/transactions
    - Use the save queue for imports instead of creating concurrent
      transactions that can time out
    - Wait for the save to finish before returning from the translate()
      promise. All save modes now use the save queue, so code that
      handled the non-save-queue process can probably be removed.
    - Serialize child attachments instead of running them concurrently.
      This might make multi-attachment saves a little slower, since they
      can't download at the same time, but it avoids problems with
      concurrent transactions. We might be able to improve this to allow
      concurrent downloads, or allow concurrent saves for a limited
      number of items (e.g., from web saving) if not for larger imports.
- Change collection handling during import, since UI is now active
  - Select the root collection at the beginning of the import
  - Assign items and collections to the root during the import instead
    of at the end
  - Don't select other collections
- Change a few ItemSaver functions to use promises and remove
  unnecessary callbacks. (This includes some connector code that needs
  to be tested.)
- Change some `parentID` variables in ItemSaver to `parentItemID` for
  clarity, since collections are now handled in more places

To-do:

- Save items in smaller batches instead of doing all in the same
  transaction
- Show progress meter in a bottom-right popup during the import
2016-12-11 02:30:34 -05:00
Dan Stillman
c61a9dc5f3 Localized plural form support for Zotero.getString()
Zotero.getString() now takes a third parameter, `num` (which should also
appear in `params`) to use when determining which plural form of the
string to use. Localized strings should include all forms in the order
specified in [1], separated by semicolons.

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals
2016-12-11 02:30:34 -05:00
Dan Stillman
9fbd84b27e Move ItemGetter test to correct section 2016-12-09 06:30:38 -05:00
Dan Stillman
fbd21bae16 Don't update feeds after syncs during tests
This reverts commit 60befe52e4 and adds a
better fix that leaves the notifier event in place. Feeds just don't
need to update after syncs during tests.
2016-12-08 05:58:46 -05:00
Adomas Venčkauskas
60befe52e4 Remove database closed errors in sync tests 2016-12-08 12:16:44 +02:00
Dan Stillman
2b9ef26c61 Fix renaming linked attachment files 2016-12-08 03:57:49 -05:00
Dan Stillman
b5bc18c7ed Add new init(options) signature for server endpoints
An endpoint can now take a single object containing 'method', 'pathname',
'query', 'headers', and 'data' and return an integer, an array containing
[statusCode, contentType, body], or a promise for either. This allows the
handlers to use the HTTP method and headers and removes the need for callbacks
when some handlers already use coroutine().

If init() returns a promise, it now has to use the new single-parameter
signature (because the check is done with Function.length, and combining
promises and callbacks doesn't make sense anyway).
2016-12-05 02:55:32 -05:00
Dan Stillman
9541a6cfcd Fix connector server test after 6900a5cc 2016-11-30 22:40:54 -05:00
Dan Stillman
4f44cc10ce Avoid CustomizableUI warnings in console after resetDB() during tests 2016-11-30 21:18:31 -05:00
Adomas Venčkauskas
45c944e731 Fix server_connector tests broken in 69ab4b0b
Don't display error prompt in standalone when style install fails.
Fixes an import bug when import input is invalid.
2016-11-30 14:58:43 +02:00
Dan Stillman
1b67ed071e Skip auto data dir migration if target dir exists and is non-empty 2016-11-30 02:09:07 -05:00
Adomas Ven
69ab4b0b1d Add server_connector endpoint to import styles and import translatable resources (#1120) 2016-11-29 14:59:58 -05:00
Dan Stillman
ec7fe773c3 Disable a test that fails too often on Travis
If someone can manage to reproduce this locally, we can try a real fix:

✖ [FAIL] should show tags in alphabetical order
  AssertionError: expected '' to equal 'A, B, C' at
        @resource://zotero-unit-tests/noteeditorTest.js:61:4
2016-11-29 04:36:59 -05:00
Dan Stillman
a114309625 Note editor test tweaks, which may or may not fix Travis failures 2016-11-29 04:26:58 -05:00
Dan Stillman
8f0ed56ae2 Test fixes after 5bceebf56c 2016-11-29 03:52:07 -05:00
Dan Stillman
8799bb4ebd Remove Travis debugging 2016-11-29 03:29:45 -05:00
Dan Stillman
5bceebf56c Reset Zotero prefs after each suite and when resetting DB
But keep prefs set in runtests.sh
2016-11-29 03:27:44 -05:00
Dan Stillman
30d0858ebf Travis debugging 2016-11-29 01:42:15 -05:00
Dan Stillman
fa859b45fe Fix running of syncLocal tests 2016-11-28 19:26:39 -05:00
Dan Stillman
a735d5dd41 Remove Travis debugging 2016-11-27 20:02:53 -05:00
Dan Stillman
837ae0444d Travis debugging 2016-11-27 19:51:48 -05:00
Dan Stillman
3a9cd31d42 Travis debugging 2016-11-27 19:46:12 -05:00
Dan Stillman
5a6f1eef63 Update deprecated uses of Zotero.getZoteroDirectory()/getZoteroDatabase()
The Zotero.DataDirectory equivalents return string paths instead of nsIFile
instances, so some of these calls now just use Zotero.File.pathToFile(), which
can be removed when the surrounding code is updated to OS.File,
2016-11-27 00:17:56 -05:00
Dan Stillman
4c0abb6816 Point other profiles to new data dir after migration (+ code reorg)
Look for other profiles, from both apps (Firefox and Standalone), that
point to the data directory being migrated and update prefs.js in those
profiles to point to the new location.

Also reorganize code into Zotero.Profile and Zotero.DataDirectory
namespaces
2016-11-27 00:17:56 -05:00
Dan Stillman
412a7990b1 Don't perform automatic migration if there's an existing pipe
This prevents us from moving the data directory if the other app
(Firefox or Standalone) is running from the same directory.

Also clean up stub code in migration tests
2016-11-26 23:09:24 -05:00
Dan Stillman
acb1be97d0 More Travis debugging 2016-11-23 00:11:01 -05:00
Dan Stillman
84bb61ab7b Fix test timeouts caused by Quick Copy initialization
When an export translator is selected for Quick Copy, Quick Copy
initialization triggers translator initialization a few seconds after
startup, because the translator code needs to be available synchronously
for drag/drop. A Quick Copy test was changing the setting to BibTeX,
which was resulting in random timeouts after subsequent resetDB() calls
due to slow translator loading. This change skips initialization in test
mode. This might actually fix a lot of timeouts on Travis in the second
half of the tests...

This also resets the Quick Copy pref in those tests so that it's left at
the default, though really we should automatically reset all prefs after
all test groups and in resetDB().
2016-11-22 20:31:58 -05:00
Dan Stillman
935d48013b Travis debugging 2016-11-22 19:35:30 -05:00
Dan Stillman
c7700f2b96 Fix warning in translate test 2016-11-22 19:06:47 -05:00
Dan Stillman
ef3e098586 Migrate data directory automatically on macOS and Linux
If data directory is within the profile directory and we can move the
subdirectories instantaneously with /bin/mv, just do it silently at startup.
2016-11-22 02:33:05 -05:00
Dan Stillman
288d0c7c06 Create 'profile' and 'Zotero' directories in temp dir for tests 2016-11-22 01:45:07 -05:00
Dan Stillman
98e3a9addf Allow immediate retry on partial data dir migration failure
A common cause of this on Windows will likely be open attachment files,
so suggest closing those and make retrying the default action.
2016-11-21 05:19:18 -05:00
Dan Stillman
ce5328cbc4 Don't trigger translator loading in download-on-demand test
This was causing later tests to time out.
2016-11-20 02:46:04 -05:00
Dan Stillman
6c6a775be2 Fix migration tests in Fx45
`arguments` wasn't iterable until 46
2016-11-20 01:54:09 -05:00
Dan Stillman
249521f12b Enable debugging for Travis error 2016-11-20 01:40:39 -05:00
Dan Stillman
6d07cb44df Fix Travis errors due to broken DirectoryIterator 2016-11-19 18:52:10 -05:00
Dan Stillman
79700969e1 Data directory migration
This adds a new button to the Advanced prefs to migrate the data directory to
$HOME/Zotero. The button only appears if the data directory is set to the
default location within a profile directory (including the other program from
the one running, even though that's technically stored as a custom data
directory).

On Mac/Linux, directories within the data directory are moved with /bin/mv.  On
Windows, or if that fails, they're copied recursively using OS.File.move()
(which annoyingly doesn't reliably support directory moving). The former should
be instantaneous on most systems (unless the data directory or 'storage' were
on a different filesystem from $HOME).

If the database fails to transfer, migration fails and the data directory
setting remains on the old directory. If the database transfers but other files
fail, the data directory setting is updated. In both cases, the user is
encouraged to migrate remaining files manually with a button that reveals the
directories and quits the program.

This isn't yet tested on Linux or Windows, and migration isn't yet suggested
automatically.

Adds Zotero.File.reveal(), Zotero.File.directoryIsEmpty(), and
Zotero.File.moveDirectory().
2016-11-13 04:55:51 -05:00
Dan Stillman
cfe76a6f83 Add Zotero.test, which is true during tests
(Zotero.automatedTest is only true in Travis)
2016-11-13 04:54:57 -05:00
Dan Stillman
341d3d69b3 Fix export failure on missing file attachments
This relies on synchronous file access, but making it async would require
rewriting all export translators that save files.
2016-10-25 02:36:13 -04:00
Dan Stillman
79baac3158 Fix relinking of imported attachment with external file 2016-10-22 15:11:12 -04:00
Adomas Venčkauskas
c1a3a8411f File descriptor hard limit changed to 4096 on Ubuntu 16.10 2016-10-21 12:29:29 +03:00
Dan Stillman
0016c5ecf8 Fix editing of saved search in a group 2016-10-20 22:55:42 -04:00
Dan Stillman
bc47b6b171 Reset Collection search condition menu on library change
Reported here:
https://github.com/zotero/zotero/issues/145#issuecomment-252678872
2016-10-11 23:55:17 -04:00
Dan Stillman
9c52ebdf8b Show saved searches under "Collection" search condition
With icons to identify collections and searches

Also:

- `savedSearch` search condition in general
- Clean up some search window code
- Reorganize search tests
2016-10-06 01:17:06 -04:00
Dan Stillman
eb1aa43da2 Remove test for Extra field parsing after 30f7ef093 2016-09-28 11:45:18 -04:00
Dan Stillman
753252be77 Merge pull request #1090 from adomasven/feature/iframe-translator-rules
Changes for #1021 to support targetAll translator property.
2016-09-28 11:42:58 -04:00
Adomas Venčkauskas
5d17ff3f53 Implements #1021 on Z4fx extension 2016-09-27 17:43:56 +03:00
Dan Stillman
4dc6ef3045 Fix #1100, Deleting collection also deletes items 2016-09-27 02:10:14 -04:00
Dan Stillman
2e8e3ffa5d Add test for Zotero.Utilities.Internal.md5()
(Though md5Async() should generally be used instead)
2016-09-24 06:54:30 -04:00
Dan Stillman
d857a06661 Use OS.File for file reads in Zotero.File.get(Binary)ContentsAsync()
This is the recommended approach (since NetUtil can still do some main-thread
I/O for files) and avoids warnings in the console.

For getContentsAsync(), also sends nsIURIs and string URIs to
Zotero.HTTP.request(), which should be used instead.

This makes getBinaryContentsAsync() much slower (due to the conversion from an
array of bytes to a binary string), but it's only used in tests. For one test
that compares two large files, use MD5 instead.
2016-09-24 06:42:30 -04:00
Dan Stillman
2320385fa8 Sync pane caption: "Zotero Data Sync" -> "Data Syncing" 2016-09-24 02:29:20 -04:00
Dan Stillman
1adb8d74f0 Properly save search when using "New Saved Search…" menu option 2016-09-23 21:03:00 -04:00
Adomas Ven
c157e01208 Closes #1097. Fixes the feed settings being reuploaded after every refresh (#1098) 2016-09-22 04:05:30 -04:00
Adomas Venčkauskas
7608e127f1 Fix nested translators that rely on child translator tags 2016-09-21 11:54:56 +03:00
Dan Stillman
dc0bb68f04 Merge pull request #1091 from adomasven/fix/connector-translation-support
Fixes overriden Zotero object in connector sandboxes
2016-09-20 14:18:07 -04:00
Adomas Venčkauskas
e83bbbad4e Fix getTranslatorCode bugs
- /connector/getTranslatorCode used to respond with empty content
- CodeGetter froze connectors by issuing hundreds of simultanious XHR
  requests
2016-09-20 15:55:58 +03:00
Dan Stillman
21d3ca298b Merge branch '4.0' 2016-09-18 18:39:18 -04:00
Sebastian Karcher
9101cb487f Parse DOI: prefixed DOI from Extra (#1089) 2016-09-14 01:31:26 +02:00
Dan Stillman
08b62f41e0 Log opened windows in waitForWindow() test support function 2016-09-06 19:16:30 -04:00
Dan Stillman
474420620e Add "Manage Styles…" link to Create Bib and Doc Prefs windows
Clicking it cancels the current window, opens the Cite pane of the
prefs, and selects the Styles tab. (This will be more useful once we
have inline style installation from that pane.)
2016-09-06 19:15:01 -04:00
Dan Stillman
f68ee60524 Follow-ups to getAPIKey() changes in 008321bb89
Addresses #1086
2016-09-05 04:00:55 -04:00
Dan Stillman
b7507b03a8 Generate citation cluster via Create Bibliography dialog
Instead of generating individual citations

This matches Quick Copy behavior and is almost certainly what people
want.
2016-08-26 02:42:56 -04:00
Dan Stillman
dbd81528d3 Fix another intermittent test failure from translator initialization 2016-08-25 12:41:18 -04:00
Dan Stillman
c310c59d32 Fix test failures on Linux due to slow translator initialization
Not sure why translator initialization is so slow on Linux, but this is
a temporary fix. More of these are probably needed.
2016-08-25 12:38:52 -04:00
Dan Stillman
bdec4b119f Fix error handling during local file import translation
A failure during detect (which is normal during file import attempts)
would cause later translator detection to fail.
2016-08-22 21:41:10 -04: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
Adomas Ven
82fcb09716 Adds a way to distinguish linux windows (#1078)
Only enabled on Xorg environments, so checks $DISPLAY
https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#X11_options
2016-08-16 04:03:07 -04:00
Adomas Ven
076bdadb29 Fixes feed sync bugs after conflicts. (#1074)
SyncedSettings.set() caches values. If an object passed to set() is
modified after the call then get() returns that modified object.
2016-08-16 03:03:42 -04:00
Dan Stillman
9ba3745b94 Don't clear md5/mtime in item JSON if skipped in patch mode
The client skips synced storage properties (md5, mtime) when uploading items to
ZFS-enabled libraries, but since the API returns JSON with those values
included after writes, they do get saved to the sync cache. If the local
attachment is then modified and the client generates a diff from the cached
version with those properties skipped, they'll be included in the patch JSON as
empty strings in order to clear them. This changes Zotero.Item::toJSON() to
skip those properties in patch mode as well.

This fixes a sync error ("Cannot change 'md5' directly in group library") when
a group attachment is updated locally.
2016-08-15 04:38:04 -04:00
Dan Stillman
c29b7eb06c Maybe fix spurious error in noteeditor tests 2016-08-15 02:35:39 -04:00
Dan Stillman
41eb49cf7f Fix handling of object-level 404/412 errors 2016-08-15 02:26:04 -04:00
Dan Stillman
daf0f8e0b0 Merge branch '4.0' 2016-08-14 17:27:36 -04:00
Dan Stillman
976b5c82c6 Fix error delaying on second library upload conflict 2016-08-14 17:23:02 -04:00
Dan Stillman
a5d74ceb81 Test with /Applications/Firefox Unbranded.app by default on OS X 2016-08-13 03:35:43 -04:00
Dan Stillman
7ea5bab206 Fix delaying if remote library version changes during downloads 2016-08-13 03:34:29 -04:00
Dan Stillman
0eb6dc9ca5 Merge branch '4.0' 2016-08-09 01:52:21 -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
ed9e655871 Pass correct event name to removeEventListener in support function 2016-07-23 16:27:44 -04:00
Dan Stillman
01ba8dfc34 Don't show missing-group warning for skipped groups 2016-07-20 15:36:31 -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
91b0acac1e Fix potential error in libraryTreeView::#_removeRow() test 2016-07-19 20:31:52 -04:00
Dan Stillman
48260e22a9 Increase tolerance on last-sync time check to prevent test failures
And compare integer timestamps directly instead of relying on implicit Date
coercion
2016-07-19 20:22:58 -04:00
Dan Stillman
5fee2bf4ca Prompt to reset library data/files on loss of write access
On reset, items are overwritten with pristine versions if available and deleted
otherwise, and then the library is marked for a full sync. Unsynced/changed
files are deleted and marked for download.

Closes #1002

Todo:

- Handle API key access change (#953, in part)
- Handle 403 from data/file upload for existing users (#1041)
2016-07-19 19:05:17 -04:00
Dan Stillman
ac34f2c4f4 Allow additional options for support test functions
- libraryVersion for createGroup()
- Zotero.Item save options for importFileAttachment()
2016-07-19 18:54:37 -04:00
Dan Stillman
e5d65f5936 Maybe reduce spurious errors in ConcurrentCaller test 2016-07-19 18:53:48 -04:00
Dan Stillman
7b45b920fc Fix clearing of missing fields in Item::fromJSON() 2016-07-18 23:44:36 -04:00
Dan Stillman
35d057decb Use new groups for collections tests 2016-07-18 17:51:59 -04:00
Dan Stillman
2d39614143 Fix subcollections being shown at top level of groups
Fixes #1065
2016-07-18 17:51:59 -04:00
Dan Stillman
cd3f621a00 Don't auto-sync skipped libraries on change 2016-07-12 00:41:08 -04:00
Dan Stillman
599598566b Use best first creator for OpenURL author, not just first position
This also fixes Google Scholar Search lookup to use an author not in first creator
position [1].

[1] https://forums.zotero.org/discussion/58384/
2016-07-11 06:30:55 -04:00
Dan Stillman
2ebd7bd114 Update search test after c1f7a188e2
c1f7a188e2 changed createDataObject('search') to create 2 search conditions
instead of 1
2016-07-07 08:39:19 -04:00
Dan Stillman
c1f7a188e2 Fix error modifying existing saved search with more than 1 condition
Closes #1056, which wasn't actually the problem
2016-07-07 07:55:15 -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
c40a5a983c Fix #1057, Item order is lost in saved search after item edit
Broken by 3dc0ad37
2016-07-06 02:09:14 -04:00
Dan Stillman
5740d4729d Use random title in search condition in createDataObject() test function
Can be retrieved with search.getConditions()[0].value and included in an item
title to have an item match the created search
2016-07-06 02:04:53 -04:00
Dan Stillman
893b9ae1fc Show "Duplicate Items" and "Unfiled Items" for all libraries by default
Previously they only showed for My Library by default, which I suspect
meant that most people didn't know you could get them for other
libraries...

This hides "Duplicate Items" and "Unfiled Items" from the context menu
when they're active, which may or may not be desirable (but we don't
show, say, "Trash" in the context menu).

Also tweaks selection behavior after hide to select next appropriate row
instead of the parent library.
2016-07-02 03:15:37 -04:00
Dan Stillman
51b3951fb0 Maintain open state of groups on collectionTreeView refresh() 2016-07-02 03:15:37 -04:00
Dan Stillman
86b5042781 Rename _rememberOpenStates() to _saveOpenStates() in collectionTreeView 2016-07-02 01:27:51 -04:00
Dan Stillman
2a55e56f3f Save open field when selecting from an item pane context menu
If a field is open and the user right-clicks on another field (e.g., swap
names, creator type, transform text), any changed value in the open field was
lost.

Also:

- Don't show swap-names menu in single-field mode

I can't quite get programmatic access to context menus to work correctly, so
tests are disabled for now. (They work individually, but not together.)
2016-06-29 05:35:51 -04:00
Adomas Ven
2cce099928 Add custom view groups for different library types (#1042)
I originally attempted this with zotero-persist and column attributes,
but there is no good way to make it succinct paramswise and the code was
painful to look at too. Thus different group settings are stored in
preferences.

Currently there are two view groups: "feed" and "default". Items view
columns have two new attributes:
`default-in` - a space separated list of views in which a column is
visible by default
`disabled-in` - a space separated list of views in which a column is
disabled by default (invisible + not possible to enable)

Fields not parsed for feeds are now disabled.
2016-06-28 20:12:54 -04:00
Dan Stillman
622530e889 Fix #1054, UI breakage after unsubscribing from feed 2016-06-28 14:29:15 -04:00
Dan Stillman
9e6565fe00 Skip skipped groups when syncing
Except if a library list is passed to Zotero.Sync.Data.Runner.sync() (which
isn't done currently but will be in #1053)

Follow-up to #1033
2016-06-27 16:48:32 -04:00
Adomas Ven
11e7cef057 Show hard warning dialog when unlinking or linking to a different account (#1047)
And give option to delete local data when unlinking

This removes the old behavior of merging accounts when syncing with a different username.
2016-06-27 12:40:38 -04:00
Dan Stillman
caaee87e9e Fix showing of WebDAV settings in sync prefs 2016-06-26 05:29:51 -04:00
Dan Stillman
7e5b46b146 Merge pull request #1048 from adomasven/fix/linux-test-failures
Fixes freezing occuring on linux while running tests
2016-06-25 07:30:35 -04:00
Dan Stillman
2f562a4fdf Fix Travis errors with OS.File.DirectoryIterator for real 2016-06-24 21:12:29 -04:00
Dan Stillman
2d88b07855 Set Zotero.automatedTest flag instead of .noUserInput on Travis
And don't skip alerts in Zotero.alert() during automated tests. (That
was intended to avoid long timeouts after unexpected failures, but,
e.g., PDF metadata lookups (which are currently disabled in automated
tests) should just be mocked so they don't intermittently fail.)
2016-06-24 18:28:32 -04:00
Dan Stillman
12fef05e18 Fix processDownload test failure on Travis
OS.File.DirectoryIterator, used by OS.File.removeDir(), isn't reliable
on Travis, returning entry.isDir == false for directories, so use
nsIFile instead

See also: 2c2a5a378
2016-06-24 18:15:32 -04:00
Dan Stillman
b1e98929fa Remove zipDirectory debugging 2016-06-24 16:54:34 -04:00
Adomas Venčkauskas
3f25d64984 Fixes freezing occuring on linux while running tests
server_connectorTest - alternating port prevents
exceptions not catchable in JS for httpd server when the socket
and the port remains open after httpd.stop() callback

support - changes the window on which `setTimeout()` is ran in dialogs.
If the timeout is ran on the main window the `dialog` object appears to
lose certain properties and not respond to interactions completely.
2016-06-23 16:15:48 +03:00
Dan Stillman
6a523347b2 Cancel delayed quickCopy initialization when resetting DB during tests
And improve cancellation of scheduled feed checks
2016-06-23 05:38:15 -04:00
Dan Stillman
3de40256bf Restore drag-and-drop Quick Copy 2016-06-23 03:08:16 -04:00
Dan Stillman
c2dd531cec Fix waitForDialog() with modal dialogs in popup windows (e.g., prefs) 2016-06-22 15:46:44 -04:00
Dan Stillman
94e0e8b752 Debugging for zipDirectory() test failure on Travis 2016-06-22 06:42:30 -04:00
Dan Stillman
48a072d254 Update library version after settings upload 2016-06-22 05:58:12 -04:00
Adomas Venčkauskas
834597c8bb Fix test failures introduced after #1044 2016-06-22 05:47:24 -04:00
Adomas Ven
dd8fd2b1ac Feed syncing (#1044)
Closes #1036

Also:

- Store sync info for feeds more compactly. Address #1037
2016-06-22 03:24:22 -04:00
Dan Stillman
8e0e69332e Fix syncing of search conditions 2016-06-20 01:08:25 -05:00
Adomas Venčkauskas
137290b97f Changes date parsing and handling for feeds. Closes #1024, #1025 2016-06-14 13:22:04 +03:00
Dan Stillman
7dda5a2f69 Fix saving to collection from fallback search translators
Fixes #1028
2016-06-11 14:54:06 -04:00
Dan Stillman
b0ef76cf57 Fix instances of browser windows being left open after tests 2016-06-11 05:10:06 -04:00
Dan Stillman
0b75b75b96 When merging items, add master item to all collections
Also changes Zotero.Item.prototype.clone() to take an `options` object for its
second parameter instead of a boolean `skipTags`. The object includes
`skipTags` as well as a new `includeCollections` property to add the new item
to the same collections.
2016-06-10 23:26:32 -04:00
Dan Stillman
3179a2f0e7 Fix various issues with note pane tags box 2016-06-10 20:35:14 -04:00
Dan Stillman
fdd90b04d3 Save to My Library via connector when read-only library is selected
(Or My Publications, which is editable but shouldn't allow direct saving)

Also switches to My Library
2016-06-09 02:47:29 -04:00
Dan Stillman
19714d5b9b Avoid logged error after server_connector saveSnapshot tests
Indexing currently happens a second after the 201 is returned to the
connector, so we have to wait for that before continuing tests, or else
a DB clear in a later test (e.g., storageLocal) will cause an error to
be logged when the indexing kicks off.
2016-06-02 16:47:27 -04:00
Dan Stillman
b5b8f2cd2f Update test for fcb6e0c06 2016-06-02 16:37:26 -04:00
Dan Stillman
88a43fea31 Handle subdirectories when extracting attachment ZIP files 2016-06-02 16:14:30 -04:00
Dan Stillman
fc4d7fa4bf Fix infinite loop in Zotero.File.zipDirectory() on subdirectory
But subdirectories shouldn't actually be used yet, because they won't
extract properly on 4.0.
2016-06-02 16:14:30 -04:00
Dan Stillman
fcb6e0c068 Save snapshots via nsIWebBrowserPersist instead of WebPageDump
WPD code hasn't been updated in many years, and there was an issue with
document permissions in 5.0. We'll need to replace nsIWBP in Electron,
but this will do for now.

Attachments are opened using file:// URIs instead of
zotero://attachment, which is what Standalone does anyway. Ancient HTML
annotations and highlights won't be displayed anymore, but I'm not sure
they worked anyway, and it hasn't been possible to create them in years.
We might be able to write out existing annotations to notes.

iframes are skipped during saving, in an attempt to reduce the number of
junk ad files. JS can still cause problems with viewing, so we might
still want to either disable scripts or force the viewed page offline
(if such a thing is possible).

There might be issues with auxiliary filename length/characters during
cross-platform file syncing. (We modified the WPD code to shorten/clean
them.)
2016-06-02 16:14:29 -04:00
Dan Stillman
e573ad886f Update recognizePDF tests
- Add test for recogning within a collection (follow-up from #1015)
- Update/remove some outdated code

These tests are still skipped by default, since we don't want to actually do
lookups on every test run.
2016-05-27 01:33:34 -04:00
Dan Stillman
47b934f67e Fix direct saving of PDFs via connector 2016-05-25 17:34:26 -04:00
Dan Stillman
6a97de8911 Update outdated Libraries.setVersion() calls in syncEngine tests 2016-05-23 01:28:50 -04:00
Dan Stillman
7b5b2dc89e Close browser window in server connector tests 2016-05-23 01:19:44 -04:00
Dan Stillman
6b0be91bf4 Clear lastViewedFolder pref when resetting DB during tests 2016-05-23 00:59:16 -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
56e40c485b A couple libraryTreeView tests 2016-05-21 16:33:46 -04:00
Dan Stillman
8b4a5936a3 Fix checking for file sync downloads at sync time 2016-05-21 16:33:45 -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
4ffd35dff2 Fix syntax error in itemTest.js 2016-05-20 23:30:21 -04:00
Dan Stillman
0be2796500 Fix webpage/snapshot saving from connector 2016-05-20 15:51:54 -04:00
Dan Stillman
d8abfa4f67 Save all item data values as string, and convert old integers to strings
Before 5.0 we performed a regexp on new item data values to determine if
they were integers and saved them natively in SQLite if so. We no longer
do that, but setField() used strict equality when checking for changes,
so an item could be marked as changed when comparing to a new string
value (e.g., from a write response from the API, which always returns
strings). To avoid that, this converts all old values in the DB to
strings and saves all incoming values as strings automatically. (This
should also help with searching and some other things.)
2016-05-18 17:25:50 -04:00
Dan Stillman
b9bbf007f0 Don't bother opening browser window for syncLocal::checkUser() tests
The window is passed to nsIPromptService, which handles finding a parent window
(hidden or otherwise) automatically if necessary.
2016-05-18 02:31:41 -04:00
Dan Stillman
0cc9926309 Fix test from d8025be67 2016-05-17 02:44:00 -04:00
Dan Stillman
d8025be676 Ignore sanitization changes when comparing notes in conflict
Until we have a consistent way of sanitizing HTML on client and server, account
for differences manually. More differences between HTMLPurifier and TinyMCE
should be added as necessary.
2016-05-17 02:33:53 -04:00
Dan Stillman
a8ea8656d2 Fix sync error after changing child item to top-level 2016-05-15 03:34:06 -04:00
Dan Stillman
eb400587e8 Fix various bugs saving from connector and add test 2016-05-13 15:00:54 -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
Adomas Ven
ddd1455aab Stub out feed updates for importFromOPML() tests
No need to do network requests
2016-05-12 16:46:30 -04:00
Dan Stillman
9345452601 Don't restore items tree scroll position if selecting new items 2016-05-09 13:58:23 -04:00
Dan Stillman
0bab038925 Fix #984, 5.0: Avoid scrolling items list when adding items via sync 2016-05-09 13:26:33 -04:00
Dan Stillman
53e1e1a9b7 .collectionTreeViewID -> .treeViewID, and add it to Zotero.Item too
Also .collectionTreeViewImage -> .treeViewImage
2016-05-09 12:34:03 -04:00
Dan Stillman
cb8b2bda1b Windows file path fixes
- Fix upgrading of Mozilla-style attachments/storage file paths on upgrade
  (requires re-upgrade)
- Save relative paths using forward slashes for consistency, and convert
  to platform-appropriate slashes on use
2016-05-09 02:30:00 -04:00
Dan Stillman
e1706e15e2 Expand/collapse library fixes
- Fixes #994, 5.0: "+" doesn't expand all collections within a library
- If a container (library, collection) is closed directly, the open state of
  all containers below it are now restored when it's reopened. Previously all
  collections would be closed on a manual reopen (though they might have been
  restored on the next Zotero restart).
- If "-" is pressed, all containers are closed, and reopening the library will
  show only top-level collections.
2016-05-07 04:02:42 -04:00
Dan Stillman
2894e4f462 Fix search by collection 2016-05-06 04:31:49 -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
ab4138cf26 Don't throw in Zotero.DataObjects::get() for nonexistent objects
Return false for single ids or skip for multiple ids. This is the original
behavior, but at some point it started throwing an UnloadedDataException. IDs
are always loaded at initialization, though, so we know whether the objects
actually exist.
2016-05-05 06:36:24 -04:00
Dan Stillman
bf3ad6a2a4 Fix test breakage from 3ab335a0 and 09c3a95a 2016-05-05 06:36:24 -04:00
Dan Stillman
3ab335a078 Don't clear search field when updating items list during sync
Fixes #985
2016-05-05 02:16:08 -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
f844d9e46d Skip full-text content download if main library version hasn't changed
Since a data sync always happens first, the main library version will
always be higher if there's any full-text content to download.
2016-05-03 01:17:53 -04:00
Dan Stillman
e0e744f9b1 Use multi-item requests for full-text writes
This is necessary to get a library version after the write instead of an
item version. Otherwise after a full-text write, the main library
version is behind, so the next sync checks all object types for that
library instead of getting a 304.

Full text is batched up to 500K characters or 10 items, whichever is
less.

This also switches to using ?format=versions for /fulltext requests,
which isn't currently necessary but reflects what it's actually doing.
2016-05-03 01:17:52 -04:00
Dan Stillman
10181f7f56 Fix sync error on missing full-text
If a version is returned for an item's full-text content but a 404 is returned
for the content itself (because it's missing in Elasticsearch for some reason),
don't throw an error.

Also remove legacy array comprehensions in fulltext and syncFullTextEngine test
files, which apparently weren't being run.
2016-04-30 01:24:33 -04:00
Dan Stillman
13c4bbebfa Save master item when merging 2016-04-29 20:29:44 -04:00
Dan Stillman
186561f320 Merge pull request #950 from adomasven/feature/import-feeds-from-opml
Close adomasven/zotero#11. Add support for feed imports from OPML files
2016-04-28 01:09:47 -04:00
Dan Stillman
f52e93dd16 Fix intermittent test failures saving from loaded RIS file
1c19fe8d81 isn't sufficient for local files, because detection is run
twice, so a translator may not be available when the detect callback is
run. This changes the test to poll for the translate icon, which is a
bit of a hack but does the job.

Unfortunately this isn't perfect either, because it seems the RIS
detection sometimes just isn't run, which means that the icon never
changes and the test times out. Maybe @simonster has an idea why that's
happening.
2016-04-27 16:07:17 -04:00
Adomas Venčkauskas
3b758e562b Close adomasven/zotero#11. Add support for feed imports from OPML files 2016-04-27 20:32:20 +01: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
6d6afdd706 Show correct quota message for personal library 2016-04-27 03:14:51 -04:00
Dan Stillman
05de47149f Allow marking of errors as handled for Bluebird
Set .handledRejection on an Error object to tell Bluebird that it's been
handled and shouldn't be logged by onPossiblyUnhandledRejection().
2016-04-27 02:32:58 -04:00
Dan Stillman
2a8cd27b49 Increase default test timeout to 10000 2016-04-26 21:46:05 -04:00