Commit graph

1065 commits

Author SHA1 Message Date
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
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
Dan Stillman
26bf507fe2 Throw invalid-data error on unknown annotation type 2021-04-01 05:52:14 -04:00
Dan Stillman
31d095fb42 Add test for citeproc-js disambiguation hang
https://github.com/Juris-M/citeproc-js/issues/179
2021-03-29 01:41:37 -04:00
Dan Stillman
5e9636089d Fix primary item types not appearing in More menu when not in MRU list
Regression in 1c366de54
2021-03-29 01:41:37 -04:00
Dan Stillman
8c341f2e26 Add field name to assertion in annotation clone test 2021-03-23 03:20:33 -04:00
Dan Stillman
dc12a2c95a Stop file upload queue after low-quota errors
We weren't making actual upload requests after a quota error if the file
would exceed the quota, but we were still going through all attachments
to upload, which in some cases involves making stat() calls. We now just
stop the queue immediately after a quota error or when starting a new
background sync after a previous quota error.

Closes #1255
2021-03-23 03:20:26 -04:00
Dan Stillman
b566c06f93 Add getImageBlob() support function for tests 2021-03-21 14:36:43 -04:00
Dan Stillman
06b28194da Show annotation widget in conflict resolution window
This adds a very basic reimplementation of the annotation widget for use
in the CR window. It's not pixel-perfect, but it's close enough that
most people probably won't notice. We'll want to replace this with a
real version that's shared between the PDF reader and the rest of the
codebase.

Image annotations currently show an "[image not shown]" placeholder.
Showing images is tricky: we don't have the remote cache image, so if
the remote position has changed, we could only show an image by
rendering it from the file, and only if the file itself hasn't changed.
Just for a better user experience, we could use the local image as long
as the position and file are both the same, but that would take some
rejiggering of the CR window.

Tags aren't shown because they're not shown for CR at all, though that
could be changed in the future.
2021-03-21 14:36:43 -04:00
Dan Stillman
7889cd5d39 Fix item.clone() on annotation items 2021-03-21 14:36:42 -04:00
Dan Stillman
0bc6b2ccc6 Transfer annotations when converting linked files to stored files
Previously, any annotations on the linked file were partially deleted,
leaving broken `items` rows without `itemAnnotations` rows.
2021-03-12 06:35:21 -05:00
Dan Stillman
24cc59cc7e Compress single-file HTML attachments and other text files
The test for ZIP uploads was having multiple files, but now snapshots
are all single files.
2021-03-10 09:37:52 -05:00
Dan Stillman
2cea1a50f5 Fix Translate.ItemGetter test
All we care about is whether annotations were excluded, so don't bother
counting all items.
2021-03-03 09:08:08 -05:00
Dan Stillman
8c1f10c782 Fix additional sync test after format=json removal 2021-03-03 08:53:28 -05:00
Dan Stillman
903fc4d9a7 Fix another cause of syncEventListener test failure 2021-03-03 08:39:45 -05:00
Dan Stillman
e8b19934e2 Fix pref setting in syncEventListener tests
Prefs are reset after every test
2021-03-03 07:15:48 -05:00
Dan Stillman
9204e18ee3 Fix sync test after removing format=json from syncAPIClient 2021-03-03 06:42:08 -05:00