Commit graph

1205 commits

Author SHA1 Message Date
Dan Stillman
644c4e5925 Add objects from failed download requests to sync queue
Previously only individual objects from successful requests that
couldn't be processed for some reason would be added to the queue.

`Sync.APIClient.downloadObjects()` now returns clearer and more
consistent results. It now returns an array of promises for objects with
a `keys` array of requested keys and either a `json` array of returned
API JSON objects or an `error` Error, depending on whether the request
succeeded or failed. This makes it easier to detect remotely missing
objects and request failures.
2021-12-10 05:56:46 -05:00
Adomas Ven
4405b59044
Add a function to download PDFs via a browser (#2248)
Fixes zotero/translators#2739
2021-12-02 04:27:33 -05:00
Dan Stillman
f772a0db7b Fix item tree test on macOS 2021-11-25 03:54:26 -05:00
Dan Stillman
07df7d0dec Fix standalone notes not being added to collections on RDF import
This includes the `Zotero.RDF.getResourceURI()` fix in
zotero/translate@85b39a5be.

This position change here for `this._handleRelated()` for attachments
isn't necessary, since the attachment is already saved and already has
an id, but it's done for consistency with the call for notes (where the
note previously didn't yet have an id).
2021-11-25 00:24:56 -05:00
Tom Najdek
092459dbfc
Mendeley Import: Tests for group annotations
Extended Mendeley Import test to include a scenario where other users
attached an annotation to an item in a group library that also exists
in user's library.
2021-11-15 11:39:57 +01:00
Tom Najdek
7664fedf70
Mendeley Import: Test skipping mismatched annotations 2021-11-15 11:37:34 +01:00
Tom Najdek
f10649483e
Mendeley Import: Add more tests for the importer
Also rephrased a comment in the importer code and renamed tests file
to mendeleyImportTest.js for consistency.
2021-11-15 11:19:19 +01:00
Dan Stillman
f5eb99ad4c Upload settings in batches of 250
Closes #2000
2021-11-07 23:46:54 -05:00
Abe Jellinek
cd3304e16c
Don't reset isRead when feed item metadata changes (#2215)
This prevents metadata changes from clearing the isRead status of feed
items as long as GUIDs remain constant. Previously, feed items with
randomized properties (like URLs generated dynamically each time the
feed is served) would be incorrectly marked as unread on every update.
2021-11-05 23:16:12 -04:00
Abe Jellinek
2cf436c67d
Async web translation (#2229) 2021-11-05 23:12:37 -04:00
Tom Najdek
7940915bb0
Fix arXiv ID not imported. Fix #2236. (#2238)
Mendeley online schema uses "arxiv", local DB uses "arxivId" hence it
was skipped. This commit adds mapping and a test.
2021-11-04 15:32:35 -04:00
Tom Najdek
882ecc205e
Mendeley import: Remove code to patch after earlier imports (#2234)
Fixes #2233, Mendeley import: Invalid-field-for-type error
2021-11-03 23:32:36 -04:00
Tom Najdek
a08c3dee14
Add tests for Zotero.File.download #2216
This test covers couple of scenarios downloading a 16MB file from a
local http server (simple and concurrently) using Zotero.File.download.

When running current implementation, this seems to fail persistently.

In real-world usage, current implementation seems to work
intermittently, failing more often for larger files.

This intermittent behaviour is most likely cause of #2216.
2021-10-02 00:39:09 +02:00
Dan Stillman
647afbb089 Update related box if related items are renamed or deleted 2021-09-14 01:50:58 -04:00
Dan Stillman
c5d89f6d07 Temporarily disable a tree test
Triggered by 4fa7070a31, but I think it's just a problem with
`ensureRowsAreVisible()` in the HTML tree
2021-08-31 07:27:49 -04:00
Dan Stillman
952663de73 Fix failing repo notice tests 2021-08-29 04:41:52 -04:00
Dan Stillman
2459614f04 Add mechanism for showing dialog with notice from repo
- Messages are shown once a day by default (within the same session for
  id-less messages)
- Messages with an `id` attribute include a checkbox to not show again
  for 30 days
- If an `infoURL` attribute is provided, a "More Information" button is
  shown that launches that URL
- If `title` is provided, it's used for the dialog title. Otherwise
  "Warning" is shown.
2021-08-29 04:25:49 -04:00
Dan Stillman
dea4a47b69 Make Zotero.HTTP retry test a bit more robust 2021-08-27 17:12:49 -04:00
Adomas Venčkauskas
b47f5f51e7 Fix a broken item tree test (since b05e22fa) 2021-08-27 16:45:24 +03:00
Adomas Venčkauskas
8ebf1609b6 Item tree selection changes and fixes
- Fixes selection events always being debounced
- Fixes some failing tests
- Ensures Select All command selects search matching children of
collapsed parents. Adds tests for this case
2021-08-21 06:58:12 -04:00
Adomas Venčkauskas
cbbff600a6 XUL -> JS tree megacommit
- Just a single huge commit. This has been developed over too long a
time, required many tiny changes across too many files and has seen too
many iterations to be separated into separate commits.
The original branch with all the messy commits will be kept around for
posterity
bb220ad0f2...adomasven:feature/react-item-tree
- Replaces XUL <tree> element across the whole zotero client codebase
with a custom supermegafast virtualized-table inspired by
react-virtualized yet mimicking old XUL treeview API. The
virtualized-table sits on top on a raw-to-the-metal,
interpreted-at-runtime JS based windowing solution inspired by
react-window. React-based solutions could not be used because they were
slow and Zotero UI needs to be responsive and be able to
display thousands of rows in a treeview without any slowdowns.
- Attempts were made at making this screen-reader friendly, but yet to
be tested with something like JAWS
- RTL-friendly
- Styling and behaviour across all platforms was copied as closely as
possible to the original XUL tree
- Instead of row-based scroll snapping this has smooth-scrolling. If
you're using arrow keys to browse through the tree then it effectively
snap-scrolls. Current CSS snap scroll attributes do not seem to work in
the way we would require even on up-to-date browsers, yet alone the ESR
version of FX that Zotero is on. JS solutions are either terrible for
performance or produce inexcusable jitter.
- When dragging-and-dropping items the initial drag freezes the UI for
a fairly jarring amount of time. Does not seem to be fixable due to
the synchronous code that needs to be run in the dragstart handler.
Used to be possible to run that code async with the XUL tree.
- Item tree column picker no longer has a dedicated button. Just
right-click the columns. The column preferences (width, order, etc) are
no longer handled by XUL, which required a custom serialization and
storage solution that throws warnings in the developer console due to
the amount of data being stored. Might cause temporary freezing on HDDs
upon column resize/reorder/visibility toggling.
- Context menu handling code basically unchanged, but any UI changes
that plugins may have wanted to do (including adding new columns) will
have to be redone by them. No serious thought has gone into how plugin
developers would achieve that yet.
- Opens up the possibility for awesome alternative ways to render the
tree items, including things like multiple-row view for the item tree,
which has been requested for a long while especially by users switching
from other referencing software
2021-08-21 06:58:12 -04:00
Dan Stillman
eac98d1c2e Add test for 4.0 → 5.0 DB upgrade
With a mechanism for specifying a zipped DB copy to use as the initial
DB when resetting the DB in tests
2021-08-17 00:41:59 -04:00
Abe Jellinek
4ebed5dee7
Update strings and add test for ADS Bibcode extraction (#2128) 2021-08-04 19:37:49 -04:00
Adomas Venčkauskas
7814efcfe2 Use zotero/translate and zotero/utilities for shared code 2021-07-28 15:46:07 +03:00
Adomas Venčkauskas
c929055571 Refactor utilities code in preparation to move to external repo 2021-07-28 15:46:07 +03:00
Martynas Bagdonas
e0bc873bce Improve embedded note image loading and deletion:
- Delete unused embedded images when note is closed.
- Load images as soon as they are downloaded.
- Introduce new notification for download event, and a test for it.
- Prevent simultaneous downloads of the same attachment.
2021-07-28 13:49:04 +03:00
Dan Stillman
1bd0e7ccda Update cross-library item drag test after 2dd16b44d 2021-07-21 00:12:42 -04:00
Dan Stillman
2dd16b44d6 Ignore items in target library trash for cross-library drags
Just don't consider items in the trash to be linked items in
item.getLinkedItem(). I'm not totally sure why we didn't do this many
years ago, since it's one of the biggest sources of confusion in Zotero.

This addresses #1648 and closes #1610, though not by undeleting and
overwriting the item in the trash. When deleting an item and then
re-dragging it from another library, I think most people would expect
the item in the trash to still exist (possibly with notes, etc.), rather
than having been automatically restored and overwritten with new data.
2021-07-20 23:45:40 -04:00
Dan Stillman
2b93b8cb56 Remove accidental .only() in test from fdcd4e51c5 2021-07-12 15:25:17 -04:00
Dan Stillman
fb01339c6b Implement library.isGroup property, which was never properly implemented
And since `Zotero.Libraries.isGroupLibrary()` just checked that
property, that hasn't worked either since `isGroup` was added in 2015.

There's no test for `.isGroup`, and the test for `isGroupLibrary()` used
`if()` instead of `it()`, so it never actually ran.

Also:

- Remove old code block in search.js that called `isGroupLibrary()`.
  Since `isGroupLibrary()` didn't work, this block was unused, and its
  logic was previously added elsewhere.
2021-07-07 01:43:22 -04:00
Dan Stillman
fdcd4e51c5 Handle additional cases of conflicting translators
And fix test failure from bde9a74f9d in CI, where the file list order is
different
2021-06-26 20:17:57 -04:00
Dan Stillman
261bb7ee91 Dictionary handling improvements
- Fix installation of dictionaries on Windows
- Use version in XPI download URL (zotero/zotero-build@c3308c7a4)
- Improve display of download errors
2021-06-26 17:09:23 -04:00
Dan Stillman
bde9a74f9d Clear caches properly when deleting duplicate translator
Among other things, if the name of a translator was changed, until
restart Zotero.Translators.getAllForType() would return the old cache
entry pointing to a file that no longer existed.
2021-06-25 06:49:18 -04:00
Dan Stillman
f80ba89971 Massively speed up tests
- Make a copy of the database after first initialization that can be
  swapped in when reinitializing in resetDB()
- Avoid unnecessary one-second delay on every reset

Probably more that can be done, but this should take minutes off the
test runs
2021-06-24 06:10:40 -04:00
Dan Stillman
9a7016ad64 Spell checker improvements
- Add/Remove Dictionaries window
- Better account for the (unlikely) possibility that a dictionary could
  be replaced by another more popular dictionary provided by a different
  extension id (tested)
- Better account for the (very unlikely) possibility that an extension
  could bundle multiple dictionaries (untested)
- Use toolkit version comparator for proper extension version
  comparisons
- Localize strings
- Add tests for updating
2021-06-23 21:56:11 -04:00
Dan Stillman
7a4b27e774
Merge pull request #2071 from jryans/feed-processor
Import feed processor
2021-06-17 03:27:36 -04:00
J. Ryan Stinnett
eaa01901ef Wire up new feed processor to Zotero's feed reader
This connects the new feed processor to Zotero's existing feed reader. The new
feed processor assumes a content window environment, so a sandbox in a parent
window is used to load it.
2021-06-16 20:59:57 +01:00
J. Ryan Stinnett
bc4aafa8e4 Add feed reader tests for parsing behavior
This adds extra tests to check parsing behavior such as entities, tag handling,
CDATA, etc. This will help ensure the new feed processor matches the previous
behavior.
2021-06-16 20:59:57 +01:00
Martynas Bagdonas
3584853f39 Fix annotations test 2021-06-09 18:12:05 +03:00
Dan Stillman
1bf7b1e88e Fix updating of attachment title in right-hand pane when changed
https://forums.zotero.org/discussion/88225/attached-file-name-doesnt-change-immediately-at-5-0-97-beta-2-8b1b2ee56
2021-05-31 03:26:06 -04:00
Dan Stillman
bec42fe2a5 Handle multibyte characters in Zotero.File.truncateFileName()
Filesystems care about byte length, not character length, so treat
maxLength as the byte length limit and truncate accordingly.

This will also now remove entire emoji characters without corrupting
them.
2021-05-20 19:25:57 -04:00
Dan Stillman
7ace5ea29e Fix unnecessary sync looping after downloading items
An extra sync loop would be performed for every object downloaded, so a
download to an empty database could result in a huge number of
unnecessary loops. This was a regression from 52932b6eb, which started
queuing auto-syncs while a sync was in progress. The fix here is to skip
auto-sync for all objects saved from a sync download.

There are two new mechanisms involved:

- Event-level notifier options that get passed to passed to notify() at
  the top level of extraData rather than being included with every
  object (e.g., because `skipAutoSync` should apply to an entire save
  transaction)
- The ability to pass event-level notifier options when initializing
  a Zotero.Notifier.Queue, such as the one used for sync downloads
2021-05-14 03:49:26 -04:00
Dan Stillman
5b0f02a12b Trigger auto-sync after item deletion
It looks like this has been broken for years.
2021-05-14 03:49:26 -04:00
J. Ryan Stinnett
bb9b796efe Tweak test runner to support more directories
This expands the test filtering in the test runner so that you can supply e.g.
`test/tests/feed*` from your shell in the `zotero` directory and correctly
filter to all feed-related tests.
2021-05-11 10:05:59 +01:00
Dan Stillman
6d5b00e94c Fix descendant collections not skipping delete log
If a collection was deleted with `skipDeleteLog: true`, descendant
collections still ended up in the delete log, which could cause
constant "Reset Group and Sync" prompts.

https://forums.zotero.org/discussion/89485/warning-when-syncing-group-library
2021-05-06 03:34:09 -04:00
Dan Stillman
76d8818bed Don't count missing annotation values as changed if empty string passed
Similar to 0d377a1c4a, this fixes an unnecessary annotation reload and
loss of unsaved typing on auto-sync immediately after an annotation is
created.
2021-04-26 03:49:59 -04:00
Dan Stillman
0d377a1c4a Clear changed state of annotation after saving color change
This was resulting in an extra 'modify' event after each sync upload.
2021-04-24 19:49:08 -04:00
Dan Stillman
749e28dc1f Fix alphabetical sorting of child attachments in new databases
Broken after global schema introduction
2021-04-18 01:44:39 -04:00
Dan Stillman
52932b6eb0 Reduce auto-sync timeout to 3 seconds and optimize auto-sync process
Reduce timeout after an object change from 15 seconds to 3 seconds,
ecxept for individual notes. We should probably kick off an auto-sync
3 seconds after a note is blurred, but that's not implemented.

We also now skip file syncing and full-text content syncing altogether
unless an attachment has changed.

Reindexing an item now kicks off auto-sync, whereas before it didn't.
2021-04-06 05:09:42 -04:00
Martynas Bagdonas
20022a5d7c Properly check schema version in note editor tests 2021-04-02 21:57:35 +03:00