Files
civitai__civitai/prisma
Manuel Emilio Urena ed82ade5a9 feat: article ingestion status + manual rescan (#2158)
* feat: add article ingestion status and manual rescan

Adds ArticleIngestionStatus enum (Pending/Scanned/Blocked/Error) to gate
article visibility by scan state, separating scan state from publication
state. Non-owner/non-mod article reads now filter on ingestion = Scanned.

Also adds a user-triggered rescan feature: article owners and moderators
can manually re-trigger image scanning and text moderation from the
article detail page, with per-article rate limiting (3/day for owners,
unlimited for mods).

Key changes:
- New Article.ingestion column with migration and serving-path gates
- rescanArticle() service: resets ingestion, re-queues images, clears
  content hash and re-submits text moderation
- article.rescan tRPC mutation with isOwnerOrModerator middleware
- Rescan menu item in ArticleContextMenu + button in ArticleScanStatus
- Search index sync on ingestion state changes via recomputeArticleIngestion
- Text moderation webhook integration for ingestion recomputation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR feedback on article ingestion and rescan

- Guard contentScannedAt to only set on transition to Scanned, preserving
  the original scan-completion timestamp for observability
- Queue search index update immediately in rescanArticle so the article
  is not searchable while rescanning
- Gate Rescan menu item behind articleImageScanning feature flag
- Use ArticleIngestionStatus.Rescan (instead of Pending) for user-triggered
  rescans and content-edit rescans to distinguish from initial pending scans

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:29:04 -04:00
..