Owner Finish control on the Series detail page: confirm-gated finish, instant un-finish (#158)
This commit is contained in:
@@ -56,6 +56,14 @@ type seriesDetailView struct {
|
||||
// Series no Reader holds can be removed, so the owner is never offered a
|
||||
// button the database will always refuse.
|
||||
CanRemove bool
|
||||
// Finished is the owner's finish stamp rendered for the control: while it
|
||||
// stands, the page offers the instant Un-finish, not the confirm-gated
|
||||
// Finish (issue #158).
|
||||
Finished bool
|
||||
// FinishedSince is the "finished <age> ago" line, "" while no finish
|
||||
// stands. It rides the meta fragment both presses swap, so the answer
|
||||
// itself shows how long the Series has been finished.
|
||||
FinishedSince string
|
||||
}
|
||||
|
||||
// adminSeriesDetail renders one Series' page, keyed by the composite
|
||||
@@ -141,6 +149,8 @@ func (h *Handler) seriesDetailView(a store.AdminSeries) seriesDetailView {
|
||||
v.Checked = since(time.Now(), time.UnixMilli(a.LatestCheckedAt))
|
||||
}
|
||||
v.Corrected = correctedAge(time.Now(), a.LatestCorrectedAt)
|
||||
v.Finished = a.FinishedAt != 0
|
||||
v.FinishedSince = finishedAge(time.Now(), a.FinishedAt)
|
||||
|
||||
// Provenance: the actor class behind the current number, evaluated in the
|
||||
// order the classes outrank one another — the owner's stamp, which a
|
||||
@@ -171,3 +181,13 @@ func correctedAge(now time.Time, at int64) string {
|
||||
}
|
||||
return "corrected " + since(now, time.UnixMilli(at))
|
||||
}
|
||||
|
||||
// finishedAge is the finish marker's text: "finished <age> ago" while the
|
||||
// stamp is set, "" when zero — zero means never finished, and the reversal
|
||||
// (un-finish) must not read as history after a press (issue #158).
|
||||
func finishedAge(now time.Time, at int64) string {
|
||||
if at == 0 {
|
||||
return ""
|
||||
}
|
||||
return "finished " + since(now, time.UnixMilli(at))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user