Commit graph

5979 commits

Author SHA1 Message Date
Dan Stillman
cac01100a6 Avoid XML Parsing Error in Firefox console for ping requests 2017-03-28 02:17:15 -04:00
Dan Stillman
7b7b268727 Remove instance of legacy shorthand function syntax 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
8edd4b0523 Fix classic Add Citation dialog after 820755e15 2017-03-27 04:39:21 -04:00
Dan Stillman
bd287013fe Missing line from 499d4e3065 2017-03-27 02:12:58 -04:00
Dan Stillman
499d4e3065 Handle missing deleted.txt in unpacked source directory
Unpacked directories aren't actually supported anymore, but fix obvious
breakage if they were.
2017-03-27 02:08:16 -04:00
Dan Stillman
4477e42cf9 Remove fallback code for symlinked Standalone dev build
No longer possible
2017-03-27 02:07:14 -04:00
Dan Stillman
3a48439c1d Ignore clicks in tag selector not on tags 2017-03-26 18:11:23 -04:00
Dan Stillman
d357382dd1 Always invalidate items tree after sort 2017-03-26 05:20:10 -04:00
Adomas Venčkauskas
bc4afb6d85 Fixes report printing. Closes #1179.
Page Setup seems to have moved into the print dialog in Firefox a while
ago
2017-03-24 17:51:04 +02: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
f4eb8ed3bb Pass chunk size to data generator
TODO: Add text fields for controlling number of items and chunk size

(Chunk size should be small for testing UI interactions and performance
but large for generating lots of data.)
2017-03-21 05:06:37 -04:00
Dan Stillman
d9b5fd78c9 Fix error from empty strings in data generator 2017-03-21 04:58:38 -04:00
Adomas Venčkauskas
dd921f340c Use data.detailedCookies in /connector/saveSnapshot 2017-03-16 17:06:01 +02:00
Dan Stillman
a3473896a5 Fix error showing some WebDAV verification errors 2017-03-13 16:02:34 -07:00
Dan Stillman
b732a82d55 Script to generate random item data
For building up a big library and testing UI interaction during writes

To use, load chrome://zotero/content/tools/data_generator.html in
Firefox (for now).

Could be improved a bit to add other kinds of data (collections,
child items, relations)
2017-03-09 04:02:09 -05:00
Dan Stillman
f9ea0af4cf Clean up a few data layer lines 2017-03-09 04:02:09 -05:00
Dan Stillman
b1fc6ac67c Fix (some) crashes switching collections while items are being added
The items list is generated from the database (via search), but new
items may have been added to the database but not yet been registered,
causing unloaded-data errors during sorting. Avoid that by not showing
unregistered items when generating the items list.

Additional protections are necessary -- it's still possible to get
errors, and maybe a crash, if an item has been registered but not yet
fully loaded -- but this addresses the most common one.
2017-03-09 04:02:09 -05:00
Dan Stillman
1711ba4dd4 Create temporary table for search without transaction 2017-03-09 04:02:09 -05:00
Adomas Venčkauskas
580cc32f6f Remove Promise.prototype.finally calls from translate.js not in ES6
We could monkey-patch a finally function in connectors as described in
this gist https://gist.github.com/jish/e9bcd75e391a2b21206b , but it
appears to silence propogation of unhandled rejections
and it could later come back to bite us in the butt.
Native and proper support for finally is, however, planned in ES7.
2017-03-07 12:38:36 +02:00
Dan Stillman
e9fd7f2dd1 Update Collection::getChildItems() when erasing item
Fixes #1188
2017-03-07 01:54:49 -05:00
Dan Stillman
dd5ae0f49c Fix Quick Copy drag with export format 2017-03-06 23:52:24 -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
59fb9d0226 Fix cross-library collection drag on Linux, probably 2017-03-04 16:38:00 -05:00
Dan Stillman
c180bce0f0 Check linked collections in both directions 2017-03-04 16:05:56 -05:00
Dan Stillman
d0d7aec4b0 Set 'copy' cursor feedback on cross-library collection drag 2017-03-04 04:17:51 -05:00
Dan Stillman
704e8ffeea Fix dragging collections between libraries 2017-03-04 04:17:25 -05:00
Dan Stillman
9ea82bb6cd Fix potential error dragging attachment with missing file 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
Adomas Venčkauskas
182b9a937b Fix (still) broken debug reporting for connectors (regression ef0d9afe8) 2017-03-03 15:02:33 +02: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
8812fd4401 Add debugging for display error reported in forums
https://forums.zotero.org/discussion/64662/5-0-beta-no-items-displayed-in-center-pane
2017-03-02 15:30:54 -05:00
Adomas Venčkauskas
6539fc44e3 Don't allow setting 0 for feed item TTL 2017-03-02 17:53:58 +02:00
Dan Stillman
945dc2825b Don't restart until after clearing storage settings when changing user
Possible that this was working previously, but no particular reason to
think that quitZotero() shouldn't be synchronous.
2017-03-02 01:32:33 -05:00
Dan Stillman
3a5490a1ef If userID is set, migrate any item relations with local user key
DB update to go along with 0d8643087a
2017-03-02 01:32:33 -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
82b789e083 Always show items-loading message switching collections in citation dialogs
Previously it only showed if library data hadn't been loaded, but
sorting can also take a little time when switching between collections.
2017-02-28 03:34:55 -05:00
Dan Stillman
737f54a70c Fix Edit Bibliography window 2017-02-28 03:34:55 -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
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
Frank Bennett
6b2bf34732 Probable typo in dataObject.js
This line just crashed on me during a sync operation in Juris-M 5.0. It looks like a typo.
2017-02-27 16:36:47 +09:00
Dan Stillman
fa680bbbf5 Fix startup error on Windows DB upgrades caused by b2b751e0a0 2017-02-26 06:14:01 -05:00
Dan Stillman
b2b751e0a0 Fix error when DB backup can't be opened 2017-02-25 18:09:15 -05:00
Dan Stillman
cb5e1fa431 Handle paginated results in Zotero.Sync.APIClient.getGroups() 2017-02-24 18:41:37 -05:00
Dan Stillman
a9dda10a7d Add Zotero.Sync.APIClient.getPaginatedResults()
Function that automatically follows Link headers and makes additional
requests as necessary, feeding the XMLHTTPRequest object from each
request to a reducer function.
2017-02-24 18:39:23 -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
0a1629e986 Fix typo in debug line 2017-02-24 02:36:18 -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
2fe756c1c9 Add collections pane context-menu option to remove archived libraries 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
b21729edd1 Fix Zotero.Sync.Data.Local._libraryHasUnsyncedFiles()
Always returned true
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
1633a73c3e Fix renaming attachment from right-hand pane 2017-02-23 20:17:40 -05:00
Dan Stillman
9073239292 Fix file sync error if local item version is greater than remote item
This can happen because objects are uploaded in batches, but the version
number from the last batch is used for all objects (since
APIClient.uploadObjects() handles batching internally).
2017-02-23 18:07:03 -05:00
Dan Stillman
6329e22a20 Show the right HTTP method in WebDAV errors
Could probably QI UnexpectedStatusException.channel to nsIHTTPChannel
and get requestMethod, but this is easier.
2017-02-23 15:21:45 -05:00
Dan Stillman
bb38c974bf Fix error importing from file (regression from 32bebeb1cd) 2017-02-22 21:46:06 -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
32bebeb1cd Fix importing from clipboard
Since there's no filename to show in the progress popup, show the
translator label (e.g., "BibTeX") instead.
2017-02-22 05:22:13 -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
1ff1fabb31 Fix dragging attachment onto item on Linux (since 1a49018bd) 2017-02-21 18:17:05 -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
90603c33b4 Remove unused properties 2017-02-21 00:04:53 -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
e465cf058e Allow opening multiple URLs via View Online 2017-02-20 18:49:35 -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
cbed716424 Fix format of object data added back to upload queue after failure 2017-02-16 18:00:13 -05:00
Dan Stillman
ddb7d3107d Include 'skipNotifier' in 'skipAll' when saving objects 2017-02-16 17:58:52 -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
469d689f37 Fix emptying from trash (broken in 7ede52355d)
Zotero.Items.eraseTx() doesn't exist -- use Zotero.Items.erase() instead
2017-02-10 14:11:10 -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
58edb3143e Update ProgressWindow constructor call after c00db272f 2017-02-08 21:23:36 -05:00
Dan Stillman
ed047f06df Don't select items added via import 2017-02-08 21:19:32 -05:00
Dan Stillman
a4572c9442 Make sure 'collections' passed to Translate is an array 2017-02-08 14:58:03 -05:00
Dan Stillman
27cb099c82 Allow asynchronous item saving in import translators
This allows for imported items to be saved individually instead of being
saved in a batch after processing the entire imported file (which for
large imports would hang the UI, even if the actual saving was
asynchronous). This also fixes the progress meter during asynchronous
saves.

To take advantage of this, import translators will need to return a
promise when available (using the native Promise object) from doImport()
and wait for optional promises from item.complete().

The logic here can probably be streamlined further. (E.g., we might be
able to say that item.complete() always returns a promise.) It's
complicated by the fact that, at the moment, Promise isn't available in
child sandboxes, though this can probably be fixed.

Tests forthcoming, but they require a translator that supports this,
which needs to be committed separately.

View with -w for a cleaner diff.
2017-02-08 14:56:44 -05:00
Dan Stillman
3e35764405 Allow altering text in a ProgressWindow line in OO mode
And fix progress meter display
2017-02-08 14:32:07 -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
a57ea28d42 Fix csledit
Closes #1149

(There's an additional change in #1149, but as far as I can tell it's
not necessary for csledit.xul.)
2017-02-03 00:53:43 -05:00
Dan Stillman
3a2fb2938d Remove temporary debugging buttons in prefs 2017-02-03 00:07:16 -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
76bc61e882 Don't unload object on save error if not new 2017-02-03 00:07:16 -05:00
Dan Stillman
79a07cad9e Return array copy in ItemFields.getItemTypeFields()/getTypeFieldsFromBase() 2017-02-03 00:07:16 -05:00
Dan Stillman
7ede52355d Require DB transaction in Zotero.Collection.prototype.removeItems()
For consistency with Zotero.Collection.prototype.addItems()
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
Adomas Venčkauskas
9ecfc31fd4 Fix translation error reporting in connectors
Closes zotero/zotero-connectors#101
2017-02-02 16:16:22 -03:00
Dan Stillman
0b9b758029 Don't localize "OpenURL" 2017-02-02 02:01:06 -05:00