Rename ReleaseURL() to ReleaseNotesURL()

admin-dashboard-redesign
Matt Baer 5 years ago
parent 84ab41697b
commit 0d79057bae
  1. 10
      admin.go
  2. 2
      templates/user/admin/app-updates.tmpl
  3. 6
      updates.go
  4. 2
      updates_test.go

@ -583,17 +583,17 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
p := struct { p := struct {
*UserPage *UserPage
LastChecked string LastChecked string
LatestVersion string LatestVersion string
LatestReleaseURL string LatestReleaseNotesURL string
UpdateAvailable bool UpdateAvailable bool
}{ }{
UserPage: NewUserPage(app, r, u, "Updates", nil), UserPage: NewUserPage(app, r, u, "Updates", nil),
} }
if app.cfg.App.UpdateChecks { if app.cfg.App.UpdateChecks {
p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM") p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM")
p.LatestVersion = app.updates.LatestVersion() p.LatestVersion = app.updates.LatestVersion()
p.LatestReleaseURL = app.updates.ReleaseURL() p.LatestReleaseNotesURL = app.updates.ReleaseNotesURL()
p.UpdateAvailable = app.updates.AreAvailable() p.UpdateAvailable = app.updates.AreAvailable()
} }

@ -12,7 +12,7 @@
{{else}} {{else}}
<p class="alert info">WriteFreely {{.LatestVersion}} is available.</p> <p class="alert info">WriteFreely {{.LatestVersion}} is available.</p>
<section class="changelog"> <section class="changelog">
For details on features, bug fixes or notes on upgrading, <a href="{{.LatestReleaseURL}}">read the release notes</a>. For details on features, bug fixes or notes on upgrading, <a href="{{.LatestReleaseNotesURL}}">read the release notes</a>.
</section> </section>
{{end}} {{end}}
<p>Last checked at: {{.LastChecked}}. <a href="/admin/updates?check=now">Check now</a>.</p> <p>Last checked at: {{.LastChecked}}. <a href="/admin/updates?check=now">Check now</a>.</p>

@ -1,5 +1,5 @@
/* /*
* Copyright © 2018-2019 A Bunch Tell LLC. * Copyright © 2019-2020 A Bunch Tell LLC.
* *
* This file is part of WriteFreely. * This file is part of WriteFreely.
* *
@ -63,9 +63,9 @@ func (uc updatesCache) LatestVersion() string {
return uc.latestVersion return uc.latestVersion
} }
// ReleaseURL returns the full URL to the blog.writefreely.org release notes // ReleaseNotesURL returns the full URL to the blog.writefreely.org release notes
// for the latest version as stored in the cache. // for the latest version as stored in the cache.
func (uc updatesCache) ReleaseURL() string { func (uc updatesCache) ReleaseNotesURL() string {
ver := strings.TrimPrefix(uc.latestVersion, "v") ver := strings.TrimPrefix(uc.latestVersion, "v")
ver = strings.TrimSuffix(ver, ".0") ver = strings.TrimSuffix(ver, ".0")
// hack until go 1.12 in build/travis // hack until go 1.12 in build/travis

@ -24,7 +24,7 @@ func TestUpdatesRoundTrip(t *testing.T) {
}) })
t.Run("Release URL", func(t *testing.T) { t.Run("Release URL", func(t *testing.T) {
url := cache.ReleaseURL() url := cache.ReleaseNotesURL()
reg, err := regexp.Compile(`^https:\/\/blog.writefreely.org\/version(-\d+){1,}$`) reg, err := regexp.Compile(`^https:\/\/blog.writefreely.org\/version(-\d+){1,}$`)
if err != nil { if err != nil {

Loading…
Cancel
Save