Commit graph

780 commits

Author SHA1 Message Date
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