Fetch comments only when asked, and pick random art from the daily page !11

merged merged by cmc on 2026-09-11 15:13 UTC · krz/skunky-art:feat/fewer-calls into main

Discussion

cmc

Stacked on !10; retarget to main once that merges.

A post or user profile view makes one upstream call instead of two: the comment thread is behind a "Comments (N)" link that adds ?comments=1, using the count the deviation call already returns. Pagination keeps the parameter. New catalogue key deviation.comments in both languages.

/api/random picks from the daily deviations page, which the API cache answers for its TTL, instead of up to three uncacheable random searches per hit. It honours nsfw and hide-ai through VisibleDeviation. API.md updated.

Five new tests: a plain post view fetches no comments and shows the link with its count, ?comments=1 fetches once, pagination carries the parameter, random serves one pick from one fetch, random with nothing visible answers 404.

Closes #11

retargeted from feat/robots-ratelimit to main: !10 merged

2026-09-11 15:13 UTC