Commit graph

1666 commits

Author SHA1 Message Date
Dan Stillman
1f401f0897 Replace Zotero.Utilities.Internal.saveURI() with Zotero.HTTP.download()
Adds a new function, Zotero.HTTP.download(), that uses
Zotero.HTTP.request(). This fixes downloads via authenticated proxies in
Zotero 7 and gives us other request() functionality (e.g., 5xx retrying)
for free.

The downside is that this is probably less efficient, potentially
loading large downloads in memory. We should create a replacement for
request() based on fetch() that supports getting the body as a
ReadableStream.

Fixes #5062
2025-03-05 04:46:51 -05:00
Abe Jellinek
3c8d50dd47 Remove loadBrowserWindow() test support function (#5050)
A browser window was no longer actually needed for charset detection
(on macOS, at least, and hopefully elsewhere) because we switched to a
HiddenFrame-based hidden browser. Remaining uses now call
`loadZoteroWindow()`.
2025-02-26 03:00:04 -05:00
Adomas Ven
2e9b9d4070
Close citation dialog if user interacts with the integration plugin (#4859)
Asks the user if they want to discard the changes in their existing dialog if
they have made changes.

If there is no citation dialog, but a command is running (like updating the document)
an alert is displayed.

Closes #4855
2025-02-18 05:52:23 -05:00
Dan Stillman
fc3b7e0f83 Local API: Fix handling of style ids without standard prefix
Follow-up to #5032
2025-02-17 03:16:22 -05:00
abaevbog
506f3b14e3
Allow dragging items, collections, and searches into trash (#5033)
Fixes: #1943
2025-02-13 02:58:25 -05:00
Abe Jellinek
5978353d57
Fix faulty siblings-of-type check in setAutoAttachmentTitle() (#5045) 2025-02-12 22:29:49 -05:00
Dan Stillman
d358915707 Update sample data for podcast/date mapping 2025-02-05 03:08:32 -05:00
Abe Jellinek
a2a99c12f5 Local API: Fix test 2025-01-28 10:44:37 -05:00
Abe Jellinek
2a7f4fb2a5 Local API: Return everything when since=0
Addresses #5011 (option A)
2025-01-28 10:39:43 -05:00
Dan Stillman
d1e67987bd Fix broken test after #5004
Reverts a change I made to the PR. Only `since=0` would be valid in the
web API, but local items don't have a version by default, so it has to
be `-1` to match those. This probably isn't a great solution, since tools
targeting the web API would use `0`, but this will fix the test for now.
2025-01-28 01:25:08 -05:00
Abe Jellinek
a7fff8cada
Local API: Add /fulltext endpoints (#5004) 2025-01-28 00:58:12 -05:00
Abe Jellinek
6cdae37e5b
Local API: Fix 500 error when attachment has unparseable path (#5010) 2025-01-28 00:54:29 -05:00
Abe Jellinek
48b50064e9
Item box: Fix missing Copy/Paste menuitems on URL fields (#5001) 2025-01-28 00:48:41 -05:00
Dan Stillman
7a467b8bfa Fix selectItems() not selecting non-top-level item in trash
https://forums.zotero.org/discussion/comment/484380/#Comment_484380

Adds `Zotero.Item#isInTrash()` that returns true if the item or any of
its ancestors is in the trash (i.e., `.deleted == true`)
2025-01-27 04:02:10 -05:00
Dan Stillman
ed045e640a Tests for Item#fromJSON() changes (#3422) 2025-01-22 03:23:06 -05:00
Dan Stillman
b86305f40e Fix json[c.field] is undefined sync error
Fix error if local note or attachment is added to a parent item while
the remote version was added to a collection. Now, the new local parent
item will be added to any collections the remote child item was added
to.

Fixes #2934
2025-01-09 03:11:01 -05:00
Dan Stillman
0b44461a66 Fix Zotero.locked getting stuck on in data directory tests
This caused later DB tests to fail due to backups not running.
2025-01-02 07:41:16 -05:00
Dan Stillman
6ee556500d fx128: Implement non-incremental backup option
A new function, `Zotero.DB.backUpDatabase()`, by default makes offline
backups, by closing the database, doing a regular file copy, and
reopening the database. It takes an options object with an `online`
flag to make online, incremental backups that can take multiple minutes
to complete, though for now we're still running them on idle.

The old function, `Zotero.DB.backupDatabase(suffix, force)`, is
deprecated and proxies to the new function, making offline backups.

Fixes #4935
2025-01-02 02:56:41 -05:00
abaevbog
7b7a0b9e46
save tagsBox updates when another item is selected (#4945)
When tagsBox item is changed by clicking on an itemTree row,
the blur even never fires on the currently focused tag. So
whatever changes were made will be discarded. To avoid it,
blur any opened tag rows (which triggers a saveTx)
when an item is being set, same way it is done in itemBox.

Also, a small tweak to properly fetch the focused tag
via editable-text:focus-within selector, since editable-text:focus is
always empty because the focus is on the input inside of
editable-text.

Fixes: #4942
2024-12-20 02:55:33 -05:00
Dan Stillman
20e28d3f9e Fix handling of redirecting OpenURL base URLs with url query parameter
For a URL like
`https://ezproxy.school.edu/login?url=http://resolver.ebscohost.com/openurl`,
without a trailing `?`, we were just adding a `%` to the end, making the
URL invalid after the redirection (`/openurl&url_ver=Z39.88-2004`
instead of `/openurl?url_ver=Z39.88-2004`).

(And apparently no one who sent in these URLs actually tested them
in-app?)
2024-12-20 02:47:36 -05:00
Dan Stillman
43f9d98c16 fx128: Fix Authorization handling in WebDAV test
Caching Basic Auth credentials with an OPTIONS on /zotero no longer
seems to cause Firefox to pass an Authorization header for
/zotero/AAAAAAAA.prop, so update test to send 401 for the .prop request.
(Presumably /zotero/BBBBBBBB.prop would at least still get the Authorization
header without a 401, but I didn't test that.)
2024-12-14 01:16:04 -05:00
Dan Stillman
fa20733353 fx128: Fix login manager for WebDAV
Only `addLogin` → `addLoginAsync` is necessary at this time, but
`findLogins` is deprecated, so switch to `searchLoginsAsync` as well.
2024-12-14 01:16:04 -05:00
Dan Stillman
7c2720e8fc Fix translate tests after #4903 2024-12-14 01:16:04 -05:00
Dan Stillman
a0bdeab401 fx128: Fix login manager
Use async methods (since the sync ones seem to already be broken from JS
despite https://bugzilla.mozilla.org/show_bug.cgi?id=1832756 still being
open) and avoid loading Firefox Accounts module
2024-12-14 01:16:03 -05:00
Dan Stillman
26bcc49174 Use arrays for DataTransfer#types in tree tests
After the fix for #4893

(And fix a bug that was revealed in the process)
2024-12-14 01:16:03 -05:00
Abe Jellinek
d9550bb5df Server: Expose actual bound port (#4903)
And:
- Use a different port for tests so server tests don't break when Zotero
  is already running
- Remove no-op httpServer.enabled pref updates in tests
   - It's already enabled, no test disables it, and any test that did
     would clean up after itself
   - Updating that pref has no effect without a separate call to
     Zotero.Server.init()
- Remove unused arg to Zotero.Server.init()
2024-12-14 01:16:03 -05:00
Abe Jellinek
f28fa763cc DataTransfer#types: contains() -> includes()
Not sure what this was before, but it's a standard read-only array now.

Fixes #4893
2024-12-14 01:16:02 -05:00
Abe Jellinek
a96b7f1b68 HiddenBrowserTest: Don't test HTML served as attachment
Something funky is going on with Content-Disposition: attachment on
displayable content in fx128. It's correctly blocking the download, but
we're no longer getting a STATE_STOP notification when that happens.
The HTML test didn't really test anything different from the
octet-stream one, so we can just remove it.

Fixes #4881
2024-12-14 01:16:02 -05:00
Dan Stillman
97329752a1 fx128: Remove Services.jsm imports
Now included automatically
2024-12-14 01:16:00 -05:00
Tom Najdek
d3ef6cfebd
Improve importing from Mendeley
- Make the annotations importer more resilient to missing data
- Fix notebooks not being imported in some cases
- Fix an instance of a hidden browser leaked by the Mendeley Importer
2024-12-11 12:44:13 +01:00
Dan Stillman
8c58d887bf Shower nicer error for malformed WebDAV URL
We fix `://` or `//` automatically after #3483, but a leading ':'
character would still show an internal `NS_ERROR_MALFORMED_URI` error.
Instead, just say "[url] is not a valid WebDAV URL".
2024-12-10 03:06:31 -05:00
windingwind
f3d274afeb
Item pane scroll pos fix after switching from note (#4897)
Follow up to #4879
fix: #4276
2024-12-09 02:26:20 -05:00
Dan Stillman
6740115cf2 Revert "Fix Item Pane unstable rendering during scrolling (#4879)"
Regressions:

https://forums.zotero.org/discussion/120216/blinking-item-pane-when-switching-item-with-pinned-section-in-the-sidenav
https://forums.zotero.org/discussion/120217/title-field-is-not-visible-anymore-after-creating-a-new-item-if-a-section-is-pinned-in-the-sidenav

This reverts commit 4067745c7a.
2024-12-04 01:35:04 -05:00
windingwind
4067745c7a
Fix Item Pane unstable rendering during scrolling (#4879)
Fix wrong vertical position in the Item Pane after switching from a note

fix: #4276
2024-12-02 22:42:32 -05:00
windingwind
7296583f2a
Fix item pane custom info row render after item change (#4875)
Add test for info row render after item change
fix: #4874
2024-11-29 16:18:31 -05:00
abaevbog
247826194a
fix advanced search anyField condition breakage (#4873)
Process "joinMode" before other conditions that may rely on it

Fixes: #4871

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2024-11-27 23:43:09 -05:00
Abe Jellinek
bc2c7956db FeedProcessor: Handle dc:creator in Atom feeds
Fixes #4857
2024-11-20 10:05:39 -05:00
windingwind
f5b653e7fd
Add item tree and info box refresh API (#4850)
For APIs that have lifecycle control, e.g. item
pane section, the `update` is passed in the init
hook.
For APIs without lifecycle, we can't pass a value.
Instead, we provide a method to refresh in the API
instance.
2024-11-20 08:35:56 -05:00
windingwind
8e2ec86e56
Fix duplicate item pane when switching to library tab before reader is loaded (#4838)
fix: #4531
2024-11-20 08:09:42 -05:00
abaevbog
e3c18ee1c7
fix "anyField" conflicting with other conditions (#4845)
Fix the glitch where having anyField search condition
along with any other condition would return an empty
result set if joinMode="any".
This would happen due to a conflict between conditions
caused by wrapping "anyField" condition set into a quickSearch
block, which enforces "AND" operator between conditions.

Fixes: #4830
2024-11-15 02:07:11 -05:00
abaevbog
e94789c8db
Make sidenav buttons keyboard accessible (#4235)
- Section buttons, Locate, and Notes in the sidenav are focusable
- itemPane section buttons are combined into one focusable
group. Those buttons by themselves don't mean anything in
the context of keyboard navigation as they just scroll
to the section in the itemPane. In fact, having info,
abstract, attachments, etc. focusable and announceable by
screen readers is just confusing. However, we do want the group
of those buttons to be focusable to switch back to
zotero-context-pane-item-deck from zotero-context-pane-notes-deck
if the notes button in the sidenav is pressed.
- sidenav can be reached by tabbing into it from the end of itemPane
or via shift-tab from the focused tab
- sidenav buttons can be navigated with up/down arrows
- notes list in the context pane can be activated via the button in the
sidenav and navigated via up/down arrows
- use command vs onclick listener for notes list context menus to work
with keyboard-triggered clicks as well
- focus itemPane when tabs are switched in sidenav
2024-11-13 00:20:21 -05:00
abaevbog
7fa00d1cfd
Don't clear quick search after removal from collection (#4618)
Do not try to re-select a previously selected item
if it was filtered out from itemTree, e.g. after
it was removed from currently selected collection.
Otherwise, quick search gets cleared in an attempt to
re-select the item.

Fixes: #4616
2024-11-12 00:28:08 -05:00
windingwind
c937b36e25
Fix child attachment shows up in item pane after being moved to trash (#4777)
fix: #4770
2024-11-12 00:14:15 -05:00
Tom Najdek
055fbb68fc
Import Mendeley notebooks (#4829) 2024-11-12 00:13:17 -05:00
windingwind
aec6e61cb3 Add ItemPaneManager.registerInfoRow API
Unify plugin API classes

Add info box custom row API tests

Refactor itemBox.js create element

Wrap hooks in API for safe call

Add test for item tree api and hook error handling

Remove try/catch from #4816

Move plugin API definitions to xpcom/pluginAPI
2024-11-11 11:27:47 -05:00
windingwind
347caaff4c Rename itemBox > infoBox
Following the discussion in #4114
2024-11-11 11:27:47 -05:00
Dan Stillman
4ca3843ce7 Prevent auth failures for Zotero Storage requests after relinking
If you unlinked your sync account and then relinked, the ZFS storage
controller would still have the old API key and file-sync requests would
fail. Since that was never supposed to be possible, it resulted in
"Group with libraryID 1 does not exist" errors during file syncing until
you restarted the app.
2024-11-08 03:19:41 -05:00
Dan Stillman
7c91f37348 Set new API key on each setCredentials() call in sync preferences tests 2024-11-08 03:18:44 -05:00
Abe Jellinek
9f8c5c8581
Add support for importing KOReader & Calibre annotations (#4780) 2024-11-08 01:16:10 -05:00
Tom Najdek
5bd068860c
Fix renaming behavior for attachment without extension (#4742)
Fix #4739
2024-10-15 06:48:04 -04:00