Commit graph

1917 commits

Author SHA1 Message Date
Dan Stillman
cfd5596814 Disable locale selector when parent style specifies default-locale
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
For a dependent CSL style with no default-locale of its own, citeproc-js
parses the parent's XML and silently uses the parent's default-locale
over any user-selected locale, making the locale dropdown a no-op. Add
a Zotero.Style.effectiveLocale getter that falls back to the parent's
locale, and use it in updateLocaleList and the locale-selector custom
element to disable the dropdown in that case.

https://forums.zotero.org/discussion/comment/512891/#Comment_512891
2026-05-21 22:32:23 -04:00
Dan Stillman
d2631cc614 Don't mark group attachment as unsynced when opened
For group items, attachmentLastRead is stored in a synced setting in My
Library rather than on the item itself, but since we didn't pass
skipSyncedUpdate, the item was being marked as needing sync, resulting
in a permission-denied error in read-only libraries.

https://forums.zotero.org/discussion/131717/opening-pdf-in-read-only-group-library-triggers-permission-denied-on-sync
2026-05-21 09:58:34 -04:00
Dan Stillman
37bf9d0965 Trigger full sync when server library version goes backward
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
When a user's account is deleted and then undeleted on the server, the
dataserver creates a fresh shardLibraries row at a low version, while the
client still has a much higher local library version. Subsequent syncs
then throw "_libraryVersion cannot decrease" and the user is stuck.

Tag the cannot-decrease errors from the library version setters with a
named error, catch it in Engine.start(), reset libraryVersion and
storageVersion to -1, and restart. The retry hits the existing
libraryVersion == -1 branch and runs _fullSync(), which re-uploads the
local library against the recreated server library.
2026-05-20 23:11:35 -04:00
Dan Stillman
f81e7cb5da Handle 429 and Retry-After in general HTTP layer
Previously only 503 + Retry-After was retried automatically; 429 was
handled only inside the sync API client. Extend _retryOnServerError()
to also retry on 429, honoring Retry-After on both 429 and 503 and
falling back to the existing exponential backoff otherwise.
2026-05-20 15:08:52 -04:00
abaevbog
8f44172342
citation dlg: sort libraries by cited count (#5925)
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
In list mode, sort libraries by the count of their items
cited in the current document, falling back to alphabetic sorting
when counts are equal, with "My Library" always getting
priority over other groups.

Fixes: #5924
2026-05-19 15:40:55 -04:00
Dan Stillman
504447de41 Close advanced search window in collectionViewItemTree notify() test
Some checks failed
CI / Build, Upload, Test (push) Has been cancelled
The test opened an advanced search window but never closed it, which
likely caused the intermittent failures in the ZoteroPane focus() test
"should shift-tab across the zotero pane".
2026-05-07 14:25:58 -04:00
Dan Stillman
99228a6c76 Disallow changing item type to/from attachment, note, or annotation
The UI doesn't allow this, but plugins could do it, leading to sync
errors. (Can't do much for direct DB access.)

https://forums.zotero.org/discussion/131286/67734299-error-happens-in-my-zotero-plz-help-me
2026-05-04 15:30:27 -04:00
Dan Stillman
8d59331d43 Fix quick search not expanding annotation rows after item tree refactor
https://forums.zotero.org/discussion/131294/quick-search-does-not-expand-annotations-10-0-beta4
2026-05-04 13:52:37 -04:00
Dan Stillman
178f162449 Add test for collection highlighting on Ctrl/Option
Covers the regression fixed by a7d001fc1d. The prior test for
_setHighlightedRowsCallback() called the callback directly, bypassing
the focus check and the keydown handler.
2026-04-29 15:21:29 -04:00
Abe Jellinek
03d94060b4 Replace chai-as-promised assertions in server_connector tests
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
2026-04-28 13:33:58 -04:00
Abe Jellinek
13cb8d99b6 Server: Remove /connector/request endpoint
Never used.
2026-04-28 13:05:31 -04:00
Abe Jellinek
82b31574a8 Server: Test new browser detection behavior 2026-04-28 13:05:31 -04:00
Dan Stillman
fd812070b6 Fix WebDAV download auth for usernames with special characters
HTTP.download() was rewritten in 0fe31b0f04 to use fetch() and build the
Basic auth header itself via btoa(username + ':' + password), but the
username and password come from nsIURI.username/password, which are
percent-encoded. As a result, a username like "user@example.com" was
sent as "user%40example.com", causing a 401 on every WebDAV download for
any user with @, :, space, etc. in their username. Other request types
were unaffected because they go through xmlhttp.open(method, url, true,
username, password), which decodes internally.

Decode username and password in _parseURI() so the values returned can
be used directly for Basic auth (and as a side effect, fix the other
display/use sites that were getting the percent-encoded form).

https://forums.zotero.org/discussion/131174/zotero-10-betas-1-2-3-cant-download-from-webdav-http-401
2026-04-28 13:00:40 -04:00
Dan Stillman
a43d6a5d37 Fix erroneous data dir reuse in new profile on Windows
In a newly created profile, we check whether another profile is using
the default data directory, and if so, we create a new data directory
named after the profile (e.g., "Zotero Work"). But on Windows, paths in
prefs.js are stored with escaped backslaches (C:\\Users\\foo\\Zotero),
so searching for the JS string with literal single backslashes
(C:\Users\foo\Zotero) always failed, we would conclude that the default
dir was unused, and we would reuse the existing database.

To fix, escape backslashes in dataDir before the substring check.
Mac/Linux paths have no backslashes so this is a no-op there.
2026-04-27 16:04:52 -04:00
Dan Stillman
1ff2f640eb Remove Zotero for Firefox data directory migration code
The new-install branch in DataDirectory.init() read prefs.js from the
default Firefox profile to detect a pre-2017 dataDir setting, and the
read was unwrapped, making prefs.js access errors fatal at startup [1].
We could add a try/catch, but after nine years, it's probably safe to
just remove the migration. If anyone is returning from >9 years in the
wilderness and they still want old unsynced Zotero data, they can
manually move their data to the default location.

[1] https://forums.zotero.org/discussion/131176/installation-error-accessing-mozillas-pref-js-see-msg-pls
2026-04-27 16:04:52 -04:00
Adomas Venčkauskas
777d01b5c2 Item Tree: Column visibility logic improvements
Columns now have properties: `enabledIn`, `disabledIn` and `defaultIn`,
corresponding to column picker availability and default visibility. The
properties now filter based on attached collection view type instead of
visibilityGroup.

Visibility groups are for views where we want distinct column sets to
persist, like the feeds view.

Collection type properties are used to specify which columns are
available for a given type, regardless of whether it's in a different
visibility group or not.
2026-04-27 14:44:39 -04:00
Adomas Venčkauskas
5ca1fbb167 Item tree refactor megacommit
Split ItemTree megaclass into:
- ItemTree - concerned with drawing the virtualized table container and
  column interaction
- ItemTreeRowProvider - provides rows and issues notifications for
  render updates
- ItemTreeRow and subclasses - contains row-specific data and rendering
  logic
- CollectionViewItemTree and its accompanying classes - a version of
  ItemTree that renders items attached to a given Collection or
  CollectionView (CollectionTreeRow).

Various improvements in logic and rendering, separation of concerns.
2026-04-27 14:44:39 -04:00
Abe Jellinek
d7920e320b cookieContextId -> userContextId 2026-04-23 15:34:28 -04:00
Abe Jellinek
f0474fa250 Add support for clearing challenge in browser during translation 2026-04-23 15:34:28 -04:00
Adomas Venčkauskas
9abd13fd22 Fix ZoteroPane tests failing intermittently 2026-04-22 10:16:05 +03:00
Dan Stillman
c52a6151dc Fix ZoteroPane.viewAttachment() tests after HTTP.download() rewrite
Some checks failed
CI / Build, Upload, Test (push) Has been cancelled
2026-04-17 15:36:21 -04:00
Dan Stillman
ce424c6b67 Fix attachment tests after HTTP.download() rewrite
Add a spy on Zotero.HTTP.download and update call-count assertions to
split between request() and download() calls. Previously download()
delegated to request(), so a single requestStub tracked everything.
2026-04-17 15:21:25 -04:00
Abe Jellinek
cc76207a23
Remove CookieSandbox, add new utility for cookie isolation (#5853) 2026-04-17 14:23:04 -04:00
Tom Najdek
32e43cb8f1
Fix tag paste to include existing field text at cursor position (#5873) 2026-04-17 14:20:52 -04:00
Dan Stillman
0fe31b0f04 Rewrite HTTP.download() to stream via fetch() + ReadableStream
- Replace XHR-based download with fetch() + response.body streaming,
  writing chunks to disk via IOUtils instead of buffering the entire
  response in memory
- Separate out the retry and URL-parsing logic so it can be reused
  between request() and download()
- Split the ZFS download code into a request() with `followRedirects:
  false` to get the metadata headers and a separate download() to
  download the file

Fixes #5476, Downloading of large files is broken
2026-04-17 14:17:40 -04:00
Dan Stillman
c2c66795d2 Add some extra asserts to debug test flakiness in CI 2026-04-17 10:47:04 -04:00
windingwind
55672ba933
Fix removal logic for menu added by MenuManager (#5886)
Add the registered main key to menu class list so that they can be found when plugin is removed.
Add test for the fix.
2026-04-17 10:13:36 -04:00
Dan Stillman
d2d4451165 Fix WebDAV tests for Account pane rename
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
2026-04-14 23:56:23 -04:00
Dan Stillman
a9fe8e3b62 Fix Account preferences tests
And update suite name
2026-04-14 22:46:37 -04:00
Dan Stillman
acfb7c7915 Rename zotero-prefpane-sync ID to zotero-prefpane-account
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
2026-04-14 16:10:50 -04:00
Dan Stillman
7334080693 Rename sync preference files to account 2026-04-14 16:10:50 -04:00
Dan Stillman
56ef61e45b Store vacuum.lastTime as seconds, not milliseconds
Also drop the default pref, since this is just internal state
2026-04-13 12:39:51 -04:00
Dan Stillman
16b63a97dd Remove concurrent backup tests
These tested racing an offline backup against an in-progress online
backup, which wouldn't happen in practice (schema backups run at startup
before the idle observer, and someone is very unlikely to perform a DB
integrity check immediately after returning from an idle that triggered
a backup). The tests relied on fragile timing and a shared tmp file,
causing failures on Linux after the WAL checkpoint change. The tests
were already skipped on macOS after switching to APFS clones.
2026-04-10 13:35:57 -04:00
Dan Stillman
b27c4cb023 Enable SQLite WAL mode and add periodic VACUUM INTO
- Switch journal mode from DELETE to WAL for better write performance.
  With EXCLUSIVE locking mode, SQLite uses heap memory for the WAL
  index, avoiding an -shm file. Set synchronous=NORMAL (matching what
  Mozilla uses for Places). Checkpoint WAL on database close so the
  .sqlite file has all data (for copies or backups).
- Add periodic database compaction on idle (after DB backup) using
  VACUUM INTO and do an atomic file swap back to zotero.sqlite if no
  writes occurred during the operation. Check if vacuuming is needed
  based on time interval (default 14 days) and freelist ratio (default
  10% threshold).
- Disable auto_vacuum, which causes fragmentation and is unnecessary
  with periodic VACUUM
- Remove the VACUUM call from the integrity check, which was always just
  an awkward hack to let people trigger a VACUUM without having an
  explicit button

Closes #652
2026-04-10 13:19:32 -04:00
Dan Stillman
f82efc766d Fix Added/Modified By visibility when switching between library types
The `_getColumns()` column cache key didn't account for library type, so
switching between personal and group libraries reused cached columns
from the previous library type. This caused `groupLibrariesOnly` columns
(Added By, Modified By) to be missing in group libraries or incorrectly
shown in personal libraries.

Additionally, `VirtualizedTable.componentDidUpdate()` only recreated its
internal `Columns` object when the id prop changed, not when the columns
prop changed, so even with correct column rebuilding in `ItemTree`, the
table wouldn't pick up the new column list.

https://forums.zotero.org/discussion/130521/added-by-column-missing
2026-04-09 11:29:02 -04:00
Abe Jellinek
4b14ca9af4
Set Recently Read threshold relative to most recent item (#5878)
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
And persist cutoff within session
2026-04-07 14:10:18 -04:00
Dan Stillman
3f0de027a2 Auto-resolve lastRead sync conflicts by picking the most recent value 2026-04-07 10:29:25 -04:00
Dan Stillman
67288047f3 Use APFS cloning for file copies on macOS
Add Zotero.File.copyFile(), which uses clonefile() on APFS with a
fallback to IOUtils.copy(), and use it for all significant file copies.
APFS is detected and cached for each parent folder via
Zotero.File.isAPFS(), which uses statfs().

On APFS, all database backups now use the offline (close/clone/reopen)
path instead of the SQLite online backup API. Cloning is nearly
instant, and backup files share disk blocks via copy-on-write, saving
potentially gigabytes of space.

Closes #5330
2026-04-03 14:33:21 -04:00
Dan Stillman
d5ee350081 Disable snapshot saving in feed item translation itest
To try to fix intermittent CI errors
2026-04-03 09:58:47 -04:00
Dan Stillman
5a347f4be5 Update style test for NLM/Vancouver style changes 2026-04-02 16:11:47 -04:00
abaevbog
c6a95fd5b7
citation dlg: fix CI test breakage (#5870)
- prevent the focus handler from resetting the cached
items in search handler
- wait for search to finish after changing dialog type
in "should not display empty note child rows" test
2026-04-02 11:27:43 -04:00
abaevbog
6f5f221db0
citation dlg: no irrelevant child rows in itemTree (#5863)
Pass filterChildItems to itemTree from citationDialog
to filter out unwanted child rows before adding them
in toggleOpenState.

In annotations mode, do not add child notes and
attachments without annotations
In add-note mode, only keep child notes that have content
2026-04-01 14:05:40 -04:00
Bogdan Abaev
0e7ed13a43 citation dlg: variable min-width for list/library
- Allow different min-width for list vs library layouts.
In library mode, we need at least 1000px to have a functional
itemTree, especially when sidepane is present. But for list
mode, 1000px is very wide, so min-width should be 800px.
Increased min-height of itemTree from 200px to 400px
- When the dialog closes, store the width/height of
the current dialog's layout. Then, when the dialog opens
next time in that layout, set window's width/height based on last saved
params. That way, one can open a citation dialog in list
mode at 800px, then open annotations dialog (always library mode)
at 1000px, and then have the citation dialog in list mode open
again at its intended 800px.
- If one switches from library to list mode, add a smooth
window resizing animation to shrink diagonally from current width
to 800px. If one switches from list to library mode,
window smoothly resizes to 1000px min-width. This is
not applied to linux where win resizing behavior is a bit jumpy.
2026-03-31 14:53:11 -04:00
Tom Najdek
f3ecf285b3
Fix flakiness in "should shift-tab across the zotero pane" test 2026-03-31 01:38:28 +02:00
Tom Najdek
2ad4618efb
Exclude ©, ®, and ™ from emoji detection regex 2026-03-29 17:51:27 +02:00
Abe Jellinek
fb8389d654
Read Aloud: Persist last-read position in synced setting (#5860) 2026-03-27 15:22:02 -04:00
Dan Stillman
391e8497a6 Handle per-object 403 on settings upload and reset to remote version
If the server returns a write report with 403 for admin-only settings,
mark successful settings as synced and reset rejected settings to
their remote values by re-downloading from the server.

Needed for #5862
2026-03-26 15:54:28 -04:00
Dan Stillman
0e8b195c5a Add tests for image annotation placeholder in notes 2026-03-24 12:09:15 -04:00
Dan Stillman
322b764091 Show email addresses in sync settings
Fetch emails from /keys response and login session result, persist them
in the local database, and display them in the sync settings for both
logged-in and logged-out-but-linked states.

Also unify the separate logged-out-linked and logged-in containers into
a single layout that toggles elements based on login state.

Requires dataserver and stream-server changes
2026-03-24 12:09:08 -04:00
Dan Stillman
5ac56ae717 Fix removing from Recently Read in read-only group libraries 2026-03-24 11:51:37 -04:00