Commit graph

1029 commits

Author SHA1 Message Date
Dan Stillman
d573a5b639 Merge pull request #1476 from adomasven:feature/connector-doc-integration
Doc Integration Endpoint for the Connector
2018-04-24 01:37:48 -04:00
Adomas Venčkauskas
593153eebe Adds a progress bar for non quick-format integration actions
The progress percentage is based on the most recent transaction
(or undeterminate if this is the first session transaction)

Fix undefined function call error
2018-04-24 01:37:10 -04:00
Dan Stillman
33f8fcfafb Fix syncing of saved search changes
Condition changes were only uploaded after every other change + sync
2018-04-22 17:27:33 -04:00
Adomas Venčkauskas
5e5b567782 Add a connector document integration endpoint
Specifically for google docs via the connector, but could potentially be
used for any integration via HTTP or connector.
2018-04-20 13:08:34 +03:00
Martynas Bagdonas
fa0576a4dd Add arXiv identifier support (#1486) 2018-04-18 13:03:10 -04:00
Dan Stillman
3835bc9110 Assign merge-tracking relations properly when merging >2 items
https://forums.zotero.org/discussion/71459/incorrect-document-refresh-after-three-item-merge
2018-04-15 17:05:55 -04:00
Frank Bennett
94271325d7 Asyncify Zotero.Relations.getByObject(), called only from item merge. (#1480)
Use getAsync() to acquire subject in Zotero.Relations.getByObject()
2018-04-14 10:26:16 -04:00
Dan Stillman
6f1833f936 Remove items from trash and My Publications when removed via sync
Zotero.Item::fromJSON() wasn't properly accounting for missing 'deleted'
or 'inPublications' properties.
2018-04-13 23:36:59 -04:00
Dan Stillman
9a304b6699 Better handling of remotely changed items in locally missing collections 2018-04-07 17:04:35 -04:00
Dan Stillman
ac4abf0ebb Avoid race conditions in conflict resolution tests 2018-04-07 17:04:00 -04:00
Dan Stillman
4f9847da04 Save parent item to correct library when recognizing PDF without DOI 2018-04-02 15:34:22 -04:00
Dan Stillman
9e955bde99 Add Zotero.Item.prototype.moveToLibrary()
Move an item and its attachments to another library. Attachments are
removed as necessary if linked files or all files aren't supported in
the target library.
2018-03-31 08:26:36 -04:00
Dan Stillman
bc141ce36b Add .allowsLinkedFiles property to Zotero.Library objects 2018-03-31 08:26:36 -04:00
Adomas Venčkauskas
bff7cee374 Add a test case for copied citations (for 9c7271c6) 2018-03-28 14:55:46 +03:00
Adomas Venčkauskas
3445519714 Fix citationByIndex[i].sortedItem errors during citation insertion
Caused by inproper handling of copy-pasted citations in documents
2018-03-26 15:31:26 +03:00
Dan Stillman
1f320e1f5d Be more lenient about Extra field values than citeproc-js
Allow fields like "Original Date: 2018" and convert them to
"original-date: 2018" when sending to citeproc-js.

For reference:

http://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html#cheater-syntax-for-odd-fields
2018-03-01 17:05:24 -05:00
Dan Stillman
e1e5178869 Shorten auto-renaming pref
So we now have autoRecognizeFiles and autoRenameFiles.
2018-03-01 04:09:17 -05:00
Dan Stillman
18d0e980d1 Increase Travis test timeout to 15 seconds
Though it probably won't help, since I imagine most timeouts are hangs
caused by race conditions
2018-03-01 03:38:46 -05:00
Dan Stillman
1cfc90186f Serialize attachment indexing
Add newly added attachments to a queue, start processing it after five
seconds have passed since the last attachment was added, and process
another every half second after that unless another is added.

This queue won't survive a restart, so the queue should really be in the
DB, but this should avoid problems when adding multiple attachments at
once.

Addresses #1284
2018-03-01 01:28:28 -05:00
Dan Stillman
97661539dc Automatically retrieve metadata when saving PDFs
Applies to dragging to the collections pane or the items pane, adding
via New Item menu, or saving via the connector server

If the renaming pref is enabled, the PDF is renamed after recognition.

Can be disabled in the preferences

Closes #917
2018-03-01 01:28:28 -05:00
Dan Stillman
3cc92fe1e9 Fix PDF recognition within collection (broken by f8b41c971c) 2018-03-01 01:20:29 -05:00
Dan Stillman
f99038fd37 Fix recognizer dialog with multiple tests
Do cleanup on 'unload' rather than 'close' (which is limited to a click
on the close button and doesn't get called for win.close()) and clear
the queue after each test.
2018-03-01 01:20:29 -05:00
Dan Stillman
f8b41c971c Automatic attachment file renaming changes
Automatic renaming is now done for dragging of an external file onto an
item (as added in 7cb95f41) as well as dragging as a linked file,
dragging a non-native (not text or HTML) URL, "Attach Link to File…",
"Attach Stored Copy of File…", and "Retrieve Metadata for PDF". It only
applies if a single file is being added and if the parent item has no
non-HTML attachments. By default, the renaming only applies to PDFs, but
this can be changed with the renameAttachmentFiles.automatic.fileTypes
hidden pref.

A new General pref, "Automatically rename attachment files using parent
metadata", controls whether the renaming happens.

Files saved via web translators are renamed regardless of this pref,
because they would often be gibberish otherwise.

Closes #113
2018-02-27 18:45:03 -05:00
Dan Stillman
f5b1ee44f3 Add Zotero.File.rename() (extracted from Zotero.Item::renameAttachmentFile()) 2018-02-27 14:24:26 -05:00
Dan Stillman
c0b63e5928 Better handling of 403 for attachment metadata upload
Check file-editing access for the group from the API before offering to
reset, update the filesEditable setting properly, and restart the sync
automatically after resetting.
2018-02-23 17:59:32 -05:00
Martynas Bagdonas
991a50d090 New PDF recognizer 2018-02-20 09:32:06 +02:00
Martynas Bagdonas
d810deaa9c Update PDF tools version and fix fulltext test 2018-02-14 04:00:02 -05:00
Dan Stillman
3f6ecc0021 Fix "Can't queue event outside of a transaction"
If a transaction took over 30 seconds and another transaction timed out
waiting for it, the second transaction would reset the notifier queue,
but if the first transaction then tried to queue an event, it would fail
with this error and roll back. (It would be nice to figure out why
transactions are taking over 30 seconds, though.)
2018-02-08 02:07:44 -05:00
Dan Stillman
c8cf9b9e6f Support for connector-based save target selection
- Updates /saveItems and /saveSnapshot to take a sessionID
- Provides a list of editable collections in the current library
- Adds an /updateSession method that takes a sessionID and updates the
  collection and tags of any items saved via that operation (and changes
  the currently selected collection)

Cross-library changes are not yet supported
2018-02-07 04:04:37 -05:00
Dan Stillman
4731b8f905 Remove fail() override in Mocha
I'm not sure what this was for, but at least with an async test function
it seems to be causing spurious "the string 'x' was thrown, throw an
Error :)" messages that hide the real error.
2018-02-07 04:04:37 -05:00
Dan Stillman
45ddf9827c Reset PDF tools path for tests in resetDB()
And include path on error when running PDF tool
2018-02-07 04:04:37 -05:00
Dan Stillman
38411fb56c Allow dragging parent items to collection if children are selected
This is a simplified version of the fix from #872. Unlike the proposal
in #36, this doesn't require all child items to be selected, since in a
search some children might be grayed out. If the child of an unselected
parent item is included, the drag isn't allowed.

Closes #36
2018-02-03 04:15:09 -05:00
Dan Stillman
ad216bcf97 Allow parentItemID as a createDataObject() parameter in tests
Not just `parentID`
2018-02-03 04:15:09 -05:00
Dan Stillman
c5fa1303e3 Prompt to reset local group files on 403 for file attachment upload
And reset modified file attachments when resetting files
2018-01-26 03:37:57 -05:00
Dan Stillman
d67c654245 Add version option to toResponseJSON() 2018-01-26 03:37:57 -05:00
Adomas Venčkauskas
d857a813b9 Fix integration test errors. Closes #1426 2018-01-25 12:48:12 +02:00
Dan Stillman
37eb597ee8 Cache PDF tools in the source directory between test runs
This avoids having to download a 13 MB file on every test run.
2018-01-18 19:24:09 -05:00
Dan Stillman
db2ddfd493 Fix Zotero.Fulltext.setItemContent() test 2018-01-18 18:55:24 -05:00
Martynas Bagdonas
723b4d32e5 Fix Zotero.Fulltext tests 2018-01-18 18:54:54 -05:00
Martynas Bagdonas
5815088586 Fix PDF tools usage in tests 2018-01-18 12:23:27 +02:00
Martynas Bagdonas
0d5ea8520a Use the bundled PDF tools 2018-01-17 13:33:18 +02:00
Dan Stillman
0cd50b5560
Merge pull request #1242 from adomasven/feature/delay-updating-citatations
Refactor integration and delay citation updates
2018-01-16 09:11:21 -05:00
Dan Stillman
7cb95f4129 Automatically rename dragged file attachments from parent metadata
Rename happens if only one file is dragged and the parent item has no
existing file attachments.

Closes #1405
2018-01-10 00:39:47 -05:00
Dan Stillman
c83de8a6ea Increase save time for Accessed test for Travis 2018-01-05 06:04:53 -05:00
Dan Stillman
3f6ef7fb01 Allow "now" in Accessed field to use current time
Closes #1340
2018-01-05 03:41:08 -05:00
Dan Stillman
fdb9e20076 Clear parentKey change marker after save
Fixes #1325, Field editor closes during auto-sync of newly created
parent item
2018-01-04 19:10:41 -05:00
Adomas Venčkauskas
2827f70daa Option to delay updating citation in document.
The checkbox in doc prefs is hidden until an update takes 5s or longer
after which the user is prompted to enable delaying.
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
6d05c3472b Add more integration tests 2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
f44d563a15 Add Zotero.Integration.Citation
- Moves a bunch of citation related processing from Integration.Session
- Replaces missing item handling with a function instead of exception
- Solves some really confusing flow issues in _processFields
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
a1acbd4038 Make current session globally available
Decoupling! Sessions can be instantiated without
Zotero.Integration.Interface
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
41c93ab034 Rename Integration.Document to Integration.Interface 2018-01-03 14:27:16 +02:00
Dan Stillman
a1c96f1db1 Fix deletion of tags across libraries
https://forums.zotero.org/discussion/comment/296384/#Comment_296384
2017-12-20 21:48:36 -05:00
Dan Stillman
df38f4ded7 Avoid upload retry loops
- Don't try uploading an object more than 5 times
- Don't retry a child item if the parent item failed too
2017-12-10 03:45:08 -05:00
Dan Stillman
f353b7ca61 API-based "Restore to Online Library"
Restores the "Restore to Zotero Server" functionality, now using the
API:

1. Get all remote keys and send `DELETE` for any that don't exist
   locally.
2. Upload all local objects in full (non-patch) mode using only library
   version so that the remotes are overwritten.
3. Reset file sync history, causing all files to be uploaded (or, more
   likely, reassociated with existing remote files).

Since these are treated as regular updates on the server, they'll sync
down to other clients normally. Unsynced changes by other clients might
still trigger conflicts.

This and Reset File Sync History can also now be run on group libraries,
with a library selector in the Reset pane (which I forgot to do with
React).

The full sync option is now removed from the Reset pane, since there
wasn't ever really a reason to run it manually.

We should be able to reimplement Restore from Online Library (#1386)
using the inverse of this approach.

Closes #914
2017-12-08 00:42:03 -05:00
Dan Stillman
da1dd75265 Don't compress uploaded data in tests
It would be better to handle this automatically in Sinon, but as it is
uploads are compressed if they're bigger than an arbitrary limit, which
can break tests unexpectedly if they check req.requestBody.
2017-12-08 00:42:03 -05:00
Dan Stillman
045f1fbb7e Add utility functions for building drop-down library lists
A XUL one for the current use in Advanced Search and an HTML one for
future uses. Sets the value to libraryID and adds data attributes for
editable/filesEditable on the HTML one.
2017-12-08 00:42:03 -05:00
Dan Stillman
cdaf73b3d0 Fix sync error after resetting read-only group
If an item needed to be erased, it would fail with "Cannot edit item in
read-only library", because the deletion didn't skip the edit check.
2017-12-02 01:35:23 -05:00
Adomas Venčkauskas
6970556dbd Clone feed items if translation returns no items. Closes #1377 2017-11-30 11:39:34 +02:00
Dan Stillman
88a6e4f79f Don't send inPublications=false in 'full' mode for group items 2017-11-20 16:27:45 -05:00
Dan Stillman
10a5d8d02e Check for Firefox profile access at startup and show warning
f40b7ae6ac didn't help with people who've already upgraded, so check at
startup and show a warning if the profile is inaccessible until 1) the
profile has been accessed once or 2) the user checks "Don't show again"
in the warning dialog.

Also fix Zotero.Profile.getDefaultInProfilesDir() to properly throw an
error if it can't access the default directory.
2017-11-17 22:49:57 -05:00
Dan Stillman
c7fd46e6b4 Don't ignore whitespace when sorting
Intl.Collator's ignorePunctuation ignores whitespace too, so stop using
it, since it produces much weirder results than sorting on punctuation does.
2017-11-16 01:17:24 -05:00
Dan Stillman
bbb6434524 Add test for short DOI parsing
Follow-up to #1356
2017-11-07 16:53:31 -05:00
Dan Stillman
01c71fd970 Add cleanDOI() tests
In advance of #1356

We're not properly handling DOIs in parentheses or brackets (which would
require non-regex logic), so those tests are skipped for now.
2017-11-07 15:29:32 -05:00
Dan Stillman
0bf546a0aa Fix test after a3e711b7b5 2017-11-03 04:47:04 -04:00
Dan Stillman
0f743e55c7 Fix "Rename File from Parent Metadata" if target filename exists
Add a unique numeric suffix to the filename, before any extension
2017-11-01 01:06:20 -04:00
Dan Stillman
676ab7852b Fix date parsing from Atom feeds
Use Atom namespace when getting fields, and use `<updated>` date before
`<published>`. (The dates are also available on the nsIFeedContainer
(`feedEntry`), but we're getting them directly from the fields for some
reason.)
2017-10-31 02:21:21 -04:00
Dan Stillman
2184952551 Fix -s and -e arguments for test runner 2017-10-27 04:03:11 -04:00
Dan Stillman
e22d7a8459 Fix some property access issues
- Return `undefined` instead of throwing an error trying to access
  `libraryTypeID` on a Zotero.Feed -- this fixes a test failure with
  the latest Chai, which annoyingly runs inspect() on an object passed
  to .include() regardless of whether the test succeeds
- Make some deprecated properties non-enumerable to avoid unnecessary
  logging when the object is dumped
2017-10-27 03:25:08 -04:00
Dan Stillman
34028d354e Don't try to delete Quick Start Guide items in test
We don't create these items anymore.
2017-10-27 01:09:34 -04:00
Dan Stillman
15942b97ae Bail on auto-build failure when running tests 2017-10-27 01:08:48 -04:00
Dan Stillman
f0770fa84d Fix various conflict resolution bugs
Among other things, when choosing the local side for a conflict, the
remote version could still end up being saved.
2017-10-27 01:08:38 -04:00
Dan Stillman
5901a3c7af Fix possible skipped group download when another group is archived 2017-10-26 19:05:46 -04:00
Dan Stillman
73d88421bb Fix items list problems when adding item with a search entered
When an item is created, an active quick search is cleared, but that's
now an async operation. We weren't waiting for that, which meant that
new items weren't selected and depending on a race condition could even
show the welcome pane despite there being items in the library.
2017-10-25 23:51:13 -04:00
Dan Stillman
e35b035224 Separate identifer parsing from Add Item by Identifier and search translation
- Move identifier detection to `Zotero.Utilities.Internal.extractIdentifiers()`
  so that it can be used for things other than Add Item by Identifier
  (e.g., translation-server)
- Add a `Zotero.Translate.Search::setIdentifier()` function that takes an
  identifier object produced by `extractIdentifiers()` (`{ DOI: "10/..." }`),
  converts that to the search format expected by translators, and calls setSearch()
2017-10-21 03:32:28 -04:00
Dan Stillman
39a2445d74 Update full-text sync tests after 2ecfff6681 2017-10-20 05:23:13 -04:00
Dan Stillman
773a93f55d Fix item selection that requires switching to library root
Broken in c7639f328f
2017-10-07 05:05:34 -04:00
Dan Stillman
819be60796 Switch to XMLHttpRequest for processDocuments()
processDocuments() now uses an XHR 'document' request, wrapped to
provide a 'location' property, and uses promises for a simpler call
signature (though the old one will continue to work, for existing
translators). 'done' and 'exception' can now be handled via promises,
and in the translator sandbox an optional noCompleteOnError argument
instructs it not to automatically cancel the translation process with an
error (e.g., for supplementary materials).

Since we do need a hidden browser in some situations (e.g., for saving
snapshots), the old hidden-browser-based processDocuments() is still
available as Zotero.HTTP.loadDocuments().

This hopefully also fixes various problems with document property access
in translation-server.
2017-10-05 17:18:42 -04:00
Dan Stillman
6e1e2dcf76 Disable e10s for tests 2017-10-04 21:35:22 -04:00
Dan Stillman
f7e2cd6348 Isolate test from 531170353b 2017-10-01 22:43:18 -04:00
Dan Stillman
959772dc00 Disable app update during test runs 2017-10-01 22:06:35 -04:00
Dan Stillman
531170353b Fix bidirectional relations on Duplicate Item 2017-10-01 22:04:11 -04:00
Dan Stillman
48d4d2d5a5 Standardize connector server behavior for saves to read-only libraries
Return a 500 for read-only libraries for all save modes. Read-only views
within editable libraries will save to the library root.

Addresses #185, RIS/BibTeX interception to read-only view behaves
differently from save button
2017-09-27 17:39:18 -04:00
Dan Stillman
0d3d4323b5 Fix relations import via translators
Fixes #1282
2017-09-22 01:02:50 -04:00
Dan Stillman
10cae22c55 Restrict relation predicates to letters and colons for now 2017-09-22 01:01:52 -04:00
Dan Stillman
d80aa97ebd Restore related-items tests for Zotero.Translate.ItemGetter 2017-09-22 00:59:33 -04:00
Dan Stillman
d81e2a5cf0 Fix sync errors from remote item referencing deleted local collection 2017-09-20 05:33:44 -04:00
Dan Stillman
459e26490a Better isolate collectionTreeView test 2017-09-18 17:46:03 -04:00
Dan Stillman
afc7afeb9c Fix error deleting collection after emptying trash
Follow-up to c442daedce
Fixes #1317
2017-09-18 17:03:12 -04:00
Dan Stillman
c442daedce Update collection cache after "Delete collection and items…"
Fixes #1314
2017-09-13 01:01:36 -04:00
Dan Stillman
2901174ba3 Fix intermittent item selection failure 2017-09-10 03:18:59 -04:00
Dan Stillman
91ef561474 Fix test failure after 94c4445475
If the styled textbox (i.e., TinyMCE) isn't initialized, .value now
returns null instead of throwing.
2017-08-30 18:26:01 -04:00
Dan Stillman
05d74c4cac Don't load note/attachments counts as primary data
Zotero.Item::numNotes()/numAttachments() now require 'childItems' to
have been loaded.

Fixes #1301, Slow startup with many items in trash
2017-08-30 18:08:25 -04:00
Dan Stillman
687f86af71 Allow parentID in importFileAttachment() test support function
The Zotero.Attachments functions only take parentItemID, but
createDataObject() takes parentID.
2017-08-30 18:08:25 -04:00
Dan Stillman
f4b73d22b8 Fix error relocating to filename with different Unicode normalization 2017-08-23 11:02:05 +02:00
Dan Stillman
6673c64ac6 Fix accessDate when translators set CURRENT_TIMESTAMP
(But it also seems like we always do that automatically for web
translators, so I'm not sure why so many translators set that.)
2017-08-19 15:21:57 +02:00
Dan Stillman
7386b376f3 Fix linked attachment base directory handling at drive root
The first letter of the relative path was being removed on save if the
base directory was set to the drive root (e.g. D:\ instead of D:\foo).
2017-08-18 16:06:56 +02:00
Dan Stillman
1efe54e896 Fix #1286, Show proper error messages for OS.File errors 2017-08-17 15:43:54 +02:00
Dan Stillman
13cd84e1be Fix attachment-download test 2017-08-16 01:42:21 +02:00
Adomas Venčkauskas
a5a7df328a Changes imports from connector to save to selected collection
Closes #1289
2017-08-15 11:35:53 +03:00
Dan Stillman
2770860968 Don't update storage version if file sync is stopped
Otherwise subsequent syncs won't download the remaining files until
there's a remote storage change.
2017-08-11 22:29:40 +02:00
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