Commit graph

1346 commits

Author SHA1 Message Date
Abe Jellinek
bca76319ce
getSortTitle: Strip less punctuation, trim (#2442)
Now it:

1. Strips punctuation at the beginning, no matter what it is.
2. Strips non-dash punctuation in other positions.
3. Trims the result.

This should better prevent numerical ranges from being joined into a
single number that ends up incorrectly being sorted to the very bottom.
2022-03-21 20:06:27 -04:00
Dan Stillman
3ec883a7f6 Get attachment text on-demand if not cached in Item::attachmentText
Follow-up to 58f515058 with a better approach: if no full-text cache
file, just get text directly without indexing. In the one existing use
of `attachmentText`, attachment merging, this is better anyway, because
we might be deleting the file, so there's no point wasting time
inserting words into the database.
2022-03-12 20:22:29 -05:00
Dan Stillman
46ff3cf4fb Add pending test for merging items with unindexed attachments by content
Follow-up to 58f51505
2022-03-12 19:11:39 -05:00
Martynas Bagdonas
78e1e8593a Fix note template condition evaluating to true on empty array
Fixes #2386
2022-03-11 17:04:47 +02:00
Abe Jellinek
ef82becf00
Merge attachments and update notes (#2336)
We follow a different merge procedure for each attachment type:

- For PDF attachments, compare by MD5. If no match, get the top 50 words
  in the attachment's text and hash those, then check again for a match.
  Update references to item keys in notes and annotations.
- For web (snapshot / link) attachments, compare by title and URL.
  Prefer a title + URL match but accept a title-only match.
- For other attachment types, keep all attachments from all items being
  merged.

Also:

- Move most merge tests from Duplicates to Items#merge(). It just doesn't
  make sense to worry about the UI in these.
2022-03-09 17:26:26 -05:00
Tom Najdek
8e8b03e5ff
Fix Citavi import test (#2394) 2022-03-09 14:04:23 -05:00
Tom Najdek
1ad2056674
Add support for importing Citavi annotatons (#2351) 2022-03-09 04:06:44 -05:00
Dan Stillman
c7ece79f79 Fix missing creators not being removed in item.fromJSON()
Apparently there's been a bug for years where removing a creator
remotely hasn't caused it to be removed locally via sync...

https://forums.zotero.org/discussion/94910/desktop-app-not-correctly-syncing
2022-03-09 02:43:22 -05:00
Dan Stillman
8b7afcf24c Fix utilities_item tests after adding Preprint in 053d6a011
Attachments and notes are now mapped to CSL `document` (though it
shouldn't be possible to export attachments or notes to CSL JSON anyway)
2022-03-05 07:41:42 -05:00
Dan Stillman
1ce47bc404 Add Preprint item type to additional sample data for tests 2022-03-05 07:23:50 -05:00
Dan Stillman
32fc1cad9c Add Preprint item type to sample data for tests 2022-03-05 06:03:44 -05:00
Dan Stillman
96347d4333 Fix error generate sample type/field data for tests 2022-03-05 06:03:44 -05:00
Martynas Bagdonas
b7f26c47c1 Split annotation if position data exceeds the limit 2022-02-28 20:10:20 +02:00
Dan Stillman
0e0bd0586b Update assignProps call in createUnsavedDataObject() 2022-02-21 21:22:46 -05:00
Dan Stillman
90531ea2a4 Fix notifier test after 078e3bb079 2022-02-21 19:22:29 -05:00
Dan Stillman
9cdcb2fd7c Fix DB timeout test after 078e3bb079 2022-02-21 16:58:57 -05:00
Adomas Venčkauskas
9ca617a6a9 Fix broken tests in 000599b 2022-02-21 14:06:20 +02:00
Abe Jellinek
48a3235a2e
Disable Delete/Restore menu items appropriately (#2340) 2022-02-20 11:45:53 -05:00
Dan Stillman
b54b7edf9b Don't set author name of current user when copying annotation from group
Fixes #2358
2022-02-19 13:47:28 -05:00
Dan Stillman
72ac453a8c Set createdByUserID to current user for locally created group item
Addresses #2322
2022-02-19 13:47:28 -05:00
Dan Stillman
5eee488e20 Update utilities submodule
And add tests for `Utilities.Internal.noteToTitle()`

Follow-up to zotero/utilities@df2dda23b
2022-02-19 13:43:41 -05:00
Martynas Bagdonas
5405da99db
Add support for annotation templates (#2359) 2022-02-18 14:38:36 -05:00
Dan Stillman
b99aeae76e Add DB test for combination of numbered and unnumbered query placeholders 2022-02-17 01:43:39 -05:00
Dan Stillman
cb2df23580 Add tests for directoryContains()
Follow-up to #2335
2022-02-10 03:18:06 -05:00
Dan Stillman
54eb13ce9e Fix annotation-copying tests after bacc5b4428 2022-02-09 00:07:58 -05:00
Dan Stillman
bacc5b4428 Preserve explicit annotation author name when copying from group 2022-02-08 23:57:49 -05:00
Dan Stillman
f684984b07 Copy annotations across libraries
Based on option in prefs

When copying an annotation group the
2022-02-08 06:38:32 -05:00
Dan Stillman
67451dffd5 Add annotationAuthorName property to annotation items
And pass both `authorName` and `lastCreatedByUser` to the PDF reader.
The former can either come from `createdByUser` or be set directly on
the item (for group annotations dragged to personal libraries).
2022-02-08 06:38:32 -05:00
Dan Stillman
60f9a0417f Remove isAuthor from JSON passed to PDF reader 2022-02-08 06:38:32 -05:00
Dan Stillman
cec1f18670 Fix nesting of resetUnsyncedLibraryFiles() test 2022-01-31 06:48:05 -05:00
Dan Stillman
df64a16b55 Disallow unowned group annotation edits, but allow deletions
Update `DataObject::isEditable()` to take an optional `op` argument to
test individual operations as opposed to general library editing.
Erasing objects now tests `erase`, and `Item::isEditable()` allows
`erase` for unowned group annotations while disallowing the default
`edit`.

It's still up to the reader to handle this appropriately in the UI and
not allow operations it shouldn't, but this enforces it in the data
layer.
2022-01-31 06:48:05 -05:00
Dan Stillman
5a0cd78f06 Enable PDF reader by default and enable for groups
"Zotero" is now the first and default option in the "Open PDFs using"
drop-down in the General pane of the preferences.
2022-01-31 06:48:05 -05:00
Dan Stillman
819dc7f6f4 Include "Zotero/[version]" in file sync requests
To avoid blocking by some institutional firewalls

https://forums.zotero.org/discussion/93510/general-sync-error
2021-12-27 15:54:12 -05:00
Dan Stillman
3dab64ddbb Fix error deleting some orphaned or invalid WebDAV files
If a .prop file was passed to `_deleteStorageFiles()`, it would throw
`deletePropURI.QueryInterface is not a function`.
2021-12-27 14:53:28 -05:00
Dan Stillman
71248b591d Better handling of export option for notes in items list context menu
- Show "Export Note…"/"Export Notes…" if only notes or attachments
  selected
- Don't show export option if only attachments and no embedded notes
  (was previously disabled, and still is if all notes or a mixture of
  empty notes and attachments)
2021-12-26 23:50:15 -05:00
Dan Stillman
24104dc685 Fix error generating context menu for multiple standalone attachments
Regression from f161d167ae
2021-12-26 23:15:47 -05:00
Dan Stillman
1e1969a089 Fix getBestAttachmentState() tests after b0ba7e464 2021-12-22 05:23:16 -05:00
Dan Stillman
04fa066a14 Delete items with unmodified delete key when not in collections
Closes #2209
2021-12-21 03:19:13 -05:00
Dan Stillman
abe8c39c5b Ignore blank tags when saving from translator
Instead of throwing an error
2021-12-19 03:01:59 -05:00
Adomas Ven
44b6cd0525
citeproc-rs support (#2220)
Disabled under zotero.cite.useCiteprocRs by default
2021-12-15 17:28:41 -05:00
Martynas Bagdonas
19977598eb Markdown note export (#2214) 2021-12-15 06:10:58 -05:00
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
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
8f7afb4a57 Fix Zotero.automatedTest in GitHub Actions
$TRAVIS → $CI

Some tests were being run that should be skipped
2021-03-21 17:39:49 -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
Dan Stillman
914f86839c Fix test failure in libraryTreeView after items test 2021-03-03 06:23:54 -05:00
Dan Stillman
92a073314a Enable PDF reader pref for tests 2021-03-03 05:52:57 -05:00
Dan Stillman
79950ecfe5 Exclude annotations from library export
We'll want to support this eventually, but for now they would just break
translation.
2021-03-02 18:10:44 -05:00
Dan Stillman
2d2062a63d Block saving of annotations and embedded images in groups
Both should already be disabled via the UI, but just in case there's
some way they sneak through
2021-03-02 18:10:44 -05:00
Adomas Venčkauskas
0fc9037a54 Add a version of citation dialog for citing notes 2021-03-02 18:10:44 -05:00
Dan Stillman
73ba5f9ffe Auto-sync after setting change 2021-03-02 18:10:44 -05:00
Dan Stillman
77ea19277d Remove embedded-image attachment under annotation in test 2021-03-02 18:10:44 -05:00
Dan Stillman
651aabc4dc Prevent setting parent item to non-regular item
Except for embedded-image attachments under notes and annotations under
attachments
2021-03-02 18:10:44 -05:00
Dan Stillman
8b57d0000b Don't orphan embedded-image attachments in schema integrity check! 2021-03-02 18:10:44 -05:00
Dan Stillman
eb865e2625 setAttachmentPageIndex() → setAttachmentLastPageIndex() 2021-03-02 18:10:44 -05:00
Dan Stillman
c8ee3196cd Replace attachmentPageIndex with synced-setting-based mechanism
The page index needs to be per-person in group libraries, and it should
still work in read-only libraries, so it doesn't make sense to store it
on the item. This uses a synced setting in the user's library instead.
2021-03-02 18:10:44 -05:00
Dan Stillman
4a4a54da7b Clear annotation change state after save 2021-03-02 17:58:28 -05:00
Dan Stillman
98f9a99126 Fix annotation tests after adding isExternal to annotation JSON 2021-03-02 17:58:28 -05:00
Dan Stillman
9f954488c6 Delete cache image when image annotation position changes 2021-03-02 17:58:28 -05:00
Dan Stillman
89d9efdec7 Use seconds instead of ms for attachmentLastProcessedModificationTime 2021-03-02 17:58:28 -05:00
Dan Stillman
88f886cb30 Don't delete all annotations when updating attachment item 2021-03-02 17:58:28 -05:00
Dan Stillman
857b413df1 Don't add non-syncing items to sync delete log
Currently just external annotations
2021-03-02 17:58:28 -05:00
Dan Stillman
226fc90308 Switch to cache files for image annotations
Instead of embedded-image attachments

Create with Zotero.Annotations.saveCacheImage({ libraryID, key }, blob)
2021-03-02 17:58:28 -05:00
Dan Stillman
8c464a7a8b Add options argument for Zotero.File.createDirectoryIfMissingAsync()
To allow passing 'from' argument through to OS.File.makeDir()
2021-03-02 17:58:28 -05:00
Dan Stillman
ebc0ca2462 Add annotationIsExternal property to annotations 2021-03-02 17:58:28 -05:00
Martynas Bagdonas
5266734ac9 Fix note editor tests 2021-03-02 17:58:28 -05:00
Dan Stillman
1f2408a9c5 Fix ZFS tests after removing format=json from syncAPIClient 2021-03-02 17:58:28 -05:00
Dan Stillman
0fe6e3d055 Fix some test breakages related to .note/.getNote() changes 2021-03-02 17:58:28 -05:00
Dan Stillman
9997ece0d2 Fix annotation tests for recent changes 2021-03-02 17:58:28 -05:00
Dan Stillman
55c6de23ba Add "Include Annotations" checkbox to export options dialog
This changes the attachment saveFile() function in translators to be
async. In order for errors to be properly caught, translators will need
to be changed to make doExport() async and await on saveFile() calls.
(The translation architecture theoretically already allows doExport() to
be async.)
2021-03-02 17:58:28 -05:00
Dan Stillman
b1e324ddfb Fix marking of childItems as loaded for non-top-level items
Now that attachments and notes can have child items too
2021-03-02 17:58:28 -05:00
Dan Stillman
6ee3863e37 Fix clearing of annotation fields 2021-03-02 17:58:28 -05:00
Dan Stillman
69958d4356 Return Zotero.Item objects from getAnnotations() instead of ids
Returning ids mirrors getAttachments() and getNotes(), but I think we
want to move towards a world where those return actual objects, even if
we need async load calls on the returned objects.
2021-03-02 17:58:28 -05:00
Dan Stillman
60cb299f40 Fix uploading of embedded-image attachments 2021-03-02 17:58:28 -05:00
Dan Stillman
f425b8d8d9 Fix image annotation test after Item.annotationImageURL removal 2021-03-02 17:58:28 -05:00
Dan Stillman
9a41dc69fe Add PDF attachment properties to Zotero.Item
- .attachmentLastProcessedModificationTime
- .attachmentPageIndex
2021-03-02 17:58:27 -05:00
Adomas Venčkauskas
51db52a5ea Changes for note insertion in non-GoogleDocs 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
2e9e655479 Add ability to cite Zotero notes.
<span class=citation data-citation=serialized-citation-data/>
elements will automatically be converted to zotero citations
2021-03-02 17:43:09 -05:00
Adomas Venčkauskas
2b3669afd8 Consolidate Integration.Fields into Integration.Session 2021-03-02 17:43:09 -05:00
Dan Stillman
ead8c6bb45 Fix Everything search after annotations
And replace ancient 'annotation' search condition with
'annotationText'/'annotationComment'
2021-03-02 17:39:39 -05:00
Dan Stillman
199619f40e Remove .noteSchemaVersion
This leaves item.note in place, rather than reverting all the
`getNote()` → `.note` changes. We can consider which we want to keep.
2021-03-02 17:36:05 -05:00
Dan Stillman
602e4c1e1f More annotation 'position' fixes 2021-03-02 17:36:05 -05:00
Dan Stillman
2536edb6ab Fix annotation 'position' handling and update additional sortIndex tests
Item.position has to be a string. It still gets passed to/from the PDF
reader as an object.
2021-03-02 17:36:05 -05:00
Dan Stillman
151a14c0a8 Update test for shortened annotation sortIndex 2021-03-02 17:36:05 -05:00
Dan Stillman
a0fb7a8583 Ignore remote noteSchemaVersion: 0 for items with no local note
E.g., embedded attachment notes with no note don't have an itemNotes row
and don't output noteSchemaVersion in their JSON, but they shouldn't
trigger a conflict
2021-03-02 17:36:05 -05:00
Dan Stillman
b2aee30410 Fix fromJSON() not importing parentItem for annotations 2021-03-02 17:36:05 -05:00
Dan Stillman
b8eeb3abaa Drop decimal places from annotation sortIndex 2021-03-02 17:36:05 -05:00
Dan Stillman
99b959285e Send Zotero-Schema-Version header with API requests
Set to the current global schema version
2021-03-02 17:36:05 -05:00