refactor(web): share poll-state derivation; keep zebra parity across a row swap (#146)

Review round: pollState() unifies the CanPoll/Pending/Requested derivation
used by the list row and the detail page, and the row anchor carries its
band parity with the press (hx-vals) so the swapped answer keeps the
alternation.
This commit is contained in:
2026-08-22 01:02:55 +07:00
parent fe2cd12049
commit 5b7adf5f2c
4 changed files with 51 additions and 19 deletions
+4 -5
View File
@@ -96,6 +96,7 @@ func (h *Handler) adminSeriesByKey(site, seriesID string) (store.AdminSeries, bo
// seriesDetailView shapes one AdminSeries row for display: every judgement in
// Go, the template left to print strings and flags.
func (h *Handler) seriesDetailView(a store.AdminSeries) seriesDetailView {
canPoll, pending, requested := pollState(a, time.Now())
v := seriesDetailView{
Key: a.Key(),
Site: a.Site,
@@ -107,11 +108,9 @@ func (h *Handler) seriesDetailView(a store.AdminSeries) seriesDetailView {
NoCover: a.CoverAddress == "",
Orphan: a.ReaderCount == 0,
SightingRaised: a.RaisedByReader,
CanPoll: a.SeriesURL != "" && a.ReaderCount > 0,
}
if a.ForcePollAt > a.LatestCheckedAt {
v.Pending = true
v.Requested = requestedAge(time.Now(), a.ForcePollAt)
CanPoll: canPoll,
Pending: pending,
Requested: requested,
}
if a.LatestChapterNum == nil {
v.Chapter = "—"