Skip to content

Commit

Permalink
Merge pull request #158 from tstromberg/warning-header
Browse files Browse the repository at this point in the history
stale warning: Add link to Shift-Reload documentation
  • Loading branch information
tstromberg authored Jun 19, 2020
2 parents 84ab5b5 + 357df7e commit 7577efa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func main() {
BaseDirectory: findPath(*siteDir),
Updater: u,
Party: tp,
WarnAge: (*maxRefresh * 4),
WarnAge: *maxRefresh * 4,
Name: sn,
})

Expand Down
5 changes: 3 additions & 2 deletions pkg/site/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package site
import (
"context"
"fmt"
"html/template"
"time"

"github.com/google/triage-party/pkg/hubbub"
Expand Down Expand Up @@ -70,7 +71,7 @@ func (h *Handlers) collectionPage(ctx context.Context, id string, refresh bool)
warning := ""

if time.Since(result.LatestInput) > h.warnAge {
warning = fmt.Sprintf("Service started %s ago, and is still downloading data. Data may be up to %s old, and incompletely tagged. Use Shift-Reload to force a refresh.", humanDuration(time.Since(h.startTime)), humanDuration(time.Since(result.LatestInput)))
warning = fmt.Sprintf(`Service started %s ago, and is still downloading data. Data may be up to %s old and incomplete. Use <a href='https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache">Shift-Reload</a> to force a data refresh.`, humanDuration(time.Since(h.startTime)), humanDuration(time.Since(result.LatestInput)))
}

total := 0
Expand All @@ -96,7 +97,7 @@ func (h *Handlers) collectionPage(ctx context.Context, id string, refresh bool)
CollectionResult: result,
Total: len(unique),
Types: "Issues",
Warning: warning,
Warning: template.HTML(warning),
UniqueItems: unique,
ResultAge: time.Since(age),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/site/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type Page struct {
ID string
Title string
Description string
Warning string
Warning template.HTML
Total int
TotalShown int
Types string
Expand Down

0 comments on commit 7577efa

Please sign in to comment.