mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Add skip-unreleased auto-search feature
Introduce an indexer-wide option to skip automatic searches for books with future release dates (config key: `indexer.skip_unreleased`, default ON). Adds a GET/PUT admin API for indexer options, a UI toggle on the Indexers settings tab (persisted on save), and persistence of a request-level releaseDate in the Prisma schema. Adds a new request status `awaiting_release` and wires it through constants, UI components (StatusBadge, RequestCard, RecentRequestsTable, Audiobook card/modal, RequestActions), API request flows (bookdate swipe, request creation, manual search, request PATCHs, request listing groups), and services. Implements a pure release-date utility (isUnreleased / shouldSkipAutoSearch) and updates background processors: monitor-rss-feeds (skip matches but do not mutate status), retry-missing-torrents (drives bidirectional transitions between awaiting_search and awaiting_release and queues searches when appropriate), and request-creator/bookdate swipe (gate initial auto-search). Adds tests for the swipe gate and other related test updates. Logs transitions and gate decisions for observability.
This commit is contained in:
@@ -170,4 +170,52 @@ describe('RequestCard', () => {
|
||||
|
||||
expect(screen.getByText(/Completed/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders release date when status is awaiting_release and releaseDate is provided', async () => {
|
||||
const { RequestCard } = await import('@/components/requests/RequestCard');
|
||||
|
||||
render(
|
||||
<RequestCard
|
||||
request={{
|
||||
...baseRequest,
|
||||
status: 'awaiting_release',
|
||||
releaseDate: '2026-08-15T00:00:00Z',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('Releases Aug 15, 2026')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('does not render release text when status is awaiting_release but releaseDate is null', async () => {
|
||||
const { RequestCard } = await import('@/components/requests/RequestCard');
|
||||
|
||||
render(
|
||||
<RequestCard
|
||||
request={{
|
||||
...baseRequest,
|
||||
status: 'awaiting_release',
|
||||
releaseDate: null,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByText(/^Releases /)).toBeNull();
|
||||
});
|
||||
|
||||
it('does not render release text when releaseDate is provided but status is not awaiting_release', async () => {
|
||||
const { RequestCard } = await import('@/components/requests/RequestCard');
|
||||
|
||||
render(
|
||||
<RequestCard
|
||||
request={{
|
||||
...baseRequest,
|
||||
status: 'pending',
|
||||
releaseDate: '2026-08-15T00:00:00Z',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByText(/^Releases /)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,4 +20,14 @@ describe('StatusBadge', () => {
|
||||
render(<StatusBadge status="custom_status" />);
|
||||
expect(screen.getByText('custom_status')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders the awaiting_release label with teal styling', () => {
|
||||
render(<StatusBadge status="awaiting_release" />);
|
||||
const badge = screen.getByText('Awaiting Release');
|
||||
expect(badge).toBeInTheDocument();
|
||||
expect(badge.className).toContain('bg-teal-100');
|
||||
expect(badge.className).toContain('text-teal-800');
|
||||
expect(badge.className).toContain('dark:bg-teal-900');
|
||||
expect(badge.className).toContain('dark:text-teal-200');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user