Commit graph

579 commits

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