Commit graph

1435 commits

Author SHA1 Message Date
Abe Jellinek
4187819cd1
File renaming: Match content type prefixes, add UI (#4431) 2024-07-27 03:01:43 -04:00
Abe Jellinek
7020d60351 Generalize Find Available PDF -> Find Full Text (#4397) 2024-07-27 02:11:22 -04:00
Martynas Bagdonas
d825b51db6 Fix and enable reader tests
Fixes #3256
2024-07-23 11:12:32 +03:00
Martynas Bagdonas
d16ea8fe15
Enable type change between highlight and underline (#4411) 2024-07-20 02:27:11 -04:00
Tom Najdek
f227aeb6e0
File renaming: suppress duplicate suffixes #3317 (#4389) 2024-07-16 01:59:07 -04:00
abaevbog
26f7c707ba
display emojis from color-less tag in itemTreeRow (#3330)
- display the first continuous span of emojis in the primary cell of
the itemTree for non-colored tags.
- the emojis appear after the colored tags' circles (if any)
- to keep things consistent with itemTree, sort tags in the tagsBox in
the following order: colored tags first sorted by their position,
emoji tags after sorted alphabetically, followed by remaining tags sorted
alphabetically.
2024-07-15 00:28:01 -04:00
Abe Jellinek
833ecca364
Set automatic titles in more or less all cases (#4369)
By moving the setAutoAttachmentTitle() calls to importFromFile() /
_addToDB().

Also:

- Chop off file extension when setting the parent's title based on the
  filename in Create Parent Item -> Manual Entry.
- Fix Manual Entry not renaming the attachment correctly by awaiting
  createEmptyParent().
2024-07-14 23:37:24 -04:00
Abe Jellinek
c3e927e52f Disable flaky Advanced Search test on CI
Re-enable after we figure out #4375, but this is breaking PR CI runs
right now.
2024-07-11 11:43:23 -04:00
Abe Jellinek
657d5c4c42 Fix skip() error on CI
Apparently you can't call skip() directly from a describe() block.
2024-07-10 14:03:06 -04:00
Abe Jellinek
9ea56705a0 Don't change title when renaming from parent metadata (#4363) 2024-07-10 01:51:39 -04:00
Abe Jellinek
327206f931 Rename subsequent attachments after their file base names (#4363) 2024-07-10 01:51:33 -04:00
Bogdan Abaev
2f1aa19ae5 tweaks for tests to pass after React 18 upgrade (#4338)
- Wait for the itemsView to be initialized in the onload listener of the
  Advanced Search window
- moved waitForTagSelector in a few tests to avoid it resolving too
  early. For some tests these tweaks are always required, for others -
  tests would pass half the time. Again, not clear why it's necessary,
  potentially some flakiness from react 18?
2024-07-10 01:04:33 -04:00
Dan Stillman
5c08e07bf5 Don't expect return value from renameSelectedAttachmentsFromParents()
Removed in da1599ca34, because it was inconsistent and not actually
meaningful
2024-07-09 04:47:56 -04:00
Abe Jellinek
af1a4941ce
Set automatic title on first child attachment of each type (#4237) 2024-07-09 04:11:39 -04:00
Abe Jellinek
f79a59f56a
Move various item pane strings to Fluent (#4329)
And:

- Accept Fluent l10nId/l10nArgs in ItemMessagePane#render()
- Reuse existing <description> tag to eliminate l10n flickering
2024-07-09 04:00:19 -04:00
abaevbog
2d3375e9f6
Revised logic of trashed collections in item cache (#4358)
- revert change from 2401a34031
that only loads un-trashed collections in _loadCollections.
If an item only belongs to deleted collections, item._loaded.collections = true
from _loadCollections will never run, so an exception
will be thrown in item.toJSON() when syncing happens.
Instead, to address the problem of item.getCollections()
having stale data #4307, add 'includeTrashed' parameter to
item.getCollections() based on which item._collections
will be filtered. Fixes: #4346
- revert earlier, no more necessary, changes from a532cfb475
to not alter item._collections cache when collections are being trashed or restored.
Collection is removed from item._collections only when it is permanently
erased.
- removed unnecessary test checking for consistent item._collections
value before and after reload, since item._collections is no longer
modified
- fix encountered bug where a trashed child collection is not
unloaded if a parent collection is erased without being trashed first.
- tweaked Zotero.Search sql construction to count items
that only belong to trashed collections into 'unfiled'. Fixes: #4347

---------

Co-authored-by: Dan Stillman
2024-07-09 03:34:12 -04:00
abaevbog
2401a34031
Fix updating of deleted collections in Libraries & Collections (#4324)
- listen to 'collection' notifier events and re-render
the section if a relevant collection is moved to trash or
modified. That way, a deleted collection will be removed,
a restored collection will be added back, and renaming a
collection will update the name.
- fixed a bug where a restored collection would not
be added into item._collections cache. Fixed false-positive
test for it.
- do not add deleted collections into items. _collections cache in
Zotero.Items._loadCollections. Otherwise, deleted collections will
appear in librariesCollectionsBox after the app is restarted.
2024-07-04 22:07:37 -04:00
Abe Jellinek
d8eae4cd3b Enable Undo Retrieve Metadata when translator added note (#4267)
Closes #2977
2024-07-01 03:31:45 -04:00
Dan Stillman
29fa2f7073 LABD: Add test for ignoring a file that already exists under new path 2024-07-01 01:48:22 -04:00
Dan Stillman
6942506eba Rework object type checking in items list
a532cfb475 added `isCollection()`, `isSearch()`, and `isItem()` methods
to data objects to handle collections and searches in the trash, with
`isItem()` checking whether `._ObjectType` was `Item`. That left out
feed items (`._ObjectType` == `FeedItem`), and when c384fef867 made
`getSelectedItems()` return only items, it used `isItem()`, so feed
items were excluded, which broke feed-item toggling between read and
unread [1] and possibly some other things.

The simple fix would be to make `isItem` match feed items as well (which
could potentially fix other bugs related to feed items), but there was
actually no need to add new methods (which can get confused with
`CollectionTreeRow` methods) when we can just check the object type with
`obj instanceof Zotero.Item`, which gets the benefit of inheritance and
matches `Zotero.FeedItem` instances as well.

[1] https://forums.zotero.org/discussion/115571/cannot-change-the-status-of-title-in-subscribtion
2024-06-28 02:09:49 -04:00
Dan Stillman
7f372fdd42 Add recursiveCollections test for items in deleted subcollections
Addresses #4271
2024-06-27 05:10:59 -04:00
Dan Stillman
a2dc0f7e37 Sort related items by title
Closes #4281
2024-06-26 01:02:07 -04:00
Dan Stillman
38b0b3a69a Fix bug in #_setHighlightedRowsCallback() test 2024-06-24 04:42:59 -04:00
Dan Stillman
4ca92adb89 Tests: Use select() instead of selectCollection()/selectSearch() 2024-06-24 04:40:12 -04:00
Dan Stillman
ca5ea08e2b Fix failing test from 173f4c491e 2024-06-24 03:01:57 -04:00
Dan Stillman
a9c5c1bfa5 Tests: Remove some unnecessary waitForItemsLoad() calls 2024-06-24 02:45:20 -04:00
Dan Stillman
621435be68 Tests: Rework collection/search-in-trash tests
- Update for auto-`skipSelect` on collections and searches
- Remove interdependencies that prevented independent runs
- Remove unnecessary manual object names
- Remove unnecessary delay
- Switch to new convenience selection functions
- Switch to customary object naming
2024-06-24 02:45:20 -04:00
Dan Stillman
173f4c491e Tests: Don't auto-select collections and searches after creation
This changes `createDataObject()` to pass `skipSelect: true` for objects
other than items. If a test is creating a bunch of collections, there's
no reason for each one to be selected and for an items list to start to
load. If a test does need a new collection or search to be selected, it
can call the new convenience function `await select(win, obj)`, which
will select the passed object in the collection tree and wait for its
items list to load. I'm hoping this reduces random test failures due to
items list churn.
2024-06-24 02:45:20 -04:00
Dan Stillman
09aad7b075 Tests: Make some ZoteroPane tests more reliable 2024-06-24 02:45:20 -04:00
Dan Stillman
6dfd8965f1 Fix hanging tests after c384fef867 2024-06-24 02:45:20 -04:00
Dan Stillman
764e75a39a Fix typo in test title 2024-06-23 05:09:32 -04:00
Dan Stillman
c384fef867 Add getSelectedObjects() and limit getSelectedItems() to items
This adds an explicit function on ZoteroPane and the item tree for
getting objects -- including collections and searches in the trash --
and limits `getSelectedItems()` to returning actual items from the
selection. We shim various item properties on the collections and
searches in the trash, but code that's getting the selection should be
explicit about what it wants. Outside of the trash, they're equivalent,
except `getSelectedObjects()` does have an `asIDs` mode.

This switches to using getSelectedObjects() in various places and fixes
collections in the trash appearing as belonging to My Publications when
using the collections-containing-an-item highlight [1].

This also adds support for highlighting the parent collections of
collections in the trash.

[1] https://forums.zotero.org/discussion/115449/zotero-7-beta-deleted-collection-appears-as-belonging-to-my-publications
2024-06-23 05:09:31 -04:00
Dan Stillman
a612c1227e Fix collections in trash showing up in menus
New Collection menu and Add to Collection menu

https://forums.zotero.org/discussion/115447/zotero-7-beta-deleted-collections-still-appear-in-the-ui
2024-06-22 16:33:11 -04:00
Abe Jellinek
310e741a01
Fix duplicate attachment row from attachments-box notify() (#4250) 2024-06-19 02:23:46 -04:00
Dan Stillman
fad3e25278 Local API: Return 404 for unknown group library 2024-06-19 00:40:13 -04:00
Bogdan Abaev
a532cfb475 trash functionality for collections and searches (#3307)
When a collection or a saved search is deleted, it appears in
trash among other trashed items. From there, it can be restored
or permanently deleted.

Items of trashed collections are not affected my the trashing/permanent
deletion of a collection and need to be deleted separately like before.

Subcollections of a trashed collection do not appear in the trash and
are restored or permanently deleted with the top-most trashed parent.
2024-06-17 23:14:21 -04:00
Adomas Venčkauskas
338afc2b80 Add tests for HTTP integration endpoints 2024-06-17 12:45:28 +03:00
Dan Stillman
137a1ddcc0 Missing file for 639b4b5623 2024-06-15 00:45:28 -04:00
Dan Stillman
639b4b5623 Use local HTTP server for Zotero.BrowserDownload test 2024-06-15 00:40:03 -04:00
Dan Stillman
17539404b2 Fix test failure calling item.toResponseJSON() with no library set
After #4270
2024-06-12 05:50:36 -04:00
Abe Jellinek
5d197e4b12 Mostly complete (read-only) compatibility with web library (#4270)
- Add pagination, limits, and Link header
- Add schema endpoints and dummy /settings endpoint
- Add /file endpoints
  - Browser security restrictions prevent the web library from actually loading
    the file: URIs that the local API returns, but out-of-browser use will work
    fine
- Add toResponseJSONAsync() DataObject function: delegates to toResponseJSON()
  by default, adds information that requires awaiting promises
  - Best attachment (links.attachment) and file size (links.enclosure.length)
    for items, meta.numItems for groups
  - Separate function for compatibility with the existing test code that uses
    toResponseJSON(), but we could consider unifying

This commit does not add the Access-Control headers that allow webpages to make
requests to the local API, since I don't think we actually want that.
2024-06-12 05:45:48 -04:00
Abe Jellinek
44d9530ecf Add local implementation of Zotero web API (#4270)
This required some tweaks to other parts of Zotero infrastructure:
- Search:
  - Add 'includeDeleted' condition to match behavior of 'includeTrashed' API
    parameter in a single search
- Data objects:
  - Improve toResponseJSON() implementations so output better matches the web
    API
    - Add toResponseJSON() to Zotero.Tags - has to be async so it can query the
      database and generally works differently from other toResponseJSON()
      functions, but accomplishes the same task
  - Remove unused getAPIData() and apiDataGenerator() DataObject functions. They
    aren't functional and wouldn't really make implementing the local server
    easier, so now seemed like a decent time to remove them
- Server:
  - Support resolving routes using pathparser.jsm
    - Add allowMissingParams option to PathParser#add(): prevents /route from
      matching /route/:param
  - Replace the query property of the data object sent to endpoint init()s with
    searchParams, an instance of URLSearchParams - supports #getAll() for
    repeatable parameters
- URIs:
  - Make getObjectURI() public, add utilities for converting URIs to API
    endpoints and web library URLs
2024-06-12 05:45:38 -04:00
windingwind
a6076ce76c
Fix item pane header (#4159)
* Improve feed item pane header (fixes #4141)
* Show item pane custom head when headerMode is none (fixes #4116)
* fx115: Fix button style on windows (fixes #4120)
* Move split-menu-button styles to SCSS
2024-06-04 02:14:20 -04:00
abaevbog
e7c7367509
zp tab focus tests pass if run on their own (#4183)
Make sure that more than one tab is opened before tab navigation
tests are run so that the tabs menu is always focusable.

Fixes: #4180
2024-05-31 05:54:26 -04:00
windingwind
5ebd6c4141 Try to fix unstable attachments pane test 2024-05-29 21:27:13 +08:00
Martynas Bagdonas
e96426d18c Adjust fulltext test 2024-05-28 17:32:03 +03:00
Martynas Bagdonas
97c37de7f7 Update reader and pdf-worker submodules and partially disable one test 2024-05-28 17:18:56 +03:00
windingwind
fe3dae2d15
Refactor AttachmentPreview render and discard (#4161) 2024-05-28 00:05:29 -04:00
Abe Jellinek
3176516b79 Feeds: Fix error parsing items with rights information
- 59afef6 added a duplicate assignment to item.rights that was putting
  a TextConstruct(!!!!) in the item JSON field instead of a string
- info.rights was being set to a TextConstruct (preexisting issue!)
2024-05-23 14:20:44 -04:00
Abe Jellinek
92bb96ac49 Feeds: De-prioritize prism:copyright
Seems to be more used for copyright owner names than license
information, which is probably what we want in that field when it's
available.
2024-05-23 14:16:38 -04:00