From fd91d3c53ebd2bb785673fc57039e62963d99dda Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Mon, 10 Aug 2026 16:18:08 +1000 Subject: [PATCH] fix: admin upload action fillForm()->refreshFormData(['photo_url']) (fillForm threw in action closure); photo cache-busting (?v=updated_at) so overwritten photos don't show stale browser cache (user 'reverting to old images') --- frontend/internal/handlers/location.go | 4 ++++ frontend/internal/handlers/tag_page.go | 2 ++ frontend/templates/location.html | 2 +- frontend/templates/tag-edit-inline.html | 2 +- frontend/templates/tag-edit.html | 2 +- frontend/templates/tag-public.html | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/internal/handlers/location.go b/frontend/internal/handlers/location.go index e675274..56d98d6 100644 --- a/frontend/internal/handlers/location.go +++ b/frontend/internal/handlers/location.go @@ -3,11 +3,14 @@ package handlers import ( "net/http" + "github.com/jackc/pgx/v5/pgtype" + "wherewoof/frontend/internal/db" ) // locationData is passed to the owner's location page template. type locationData struct { + UpdatedAt pgtype.Timestamptz Lat float64 Lng float64 FinderPhone string @@ -44,6 +47,7 @@ func (a *App) ServeShort(w http.ResponseWriter, r *http.Request) { } data := locationData{ + UpdatedAt: tag.UpdatedAt, Lat: scan.Lat.Float64, Lng: scan.Lng.Float64, FinderPhone: scan.ScannerPhone.String, diff --git a/frontend/internal/handlers/tag_page.go b/frontend/internal/handlers/tag_page.go index 380db4c..260836b 100644 --- a/frontend/internal/handlers/tag_page.go +++ b/frontend/internal/handlers/tag_page.go @@ -11,6 +11,7 @@ import ( ) type publicData struct { + UpdatedAt pgtype.Timestamptz ID int64 TagCode string Status string @@ -47,6 +48,7 @@ func (a *App) PublicTag(w http.ResponseWriter, r *http.Request) { } pd := publicData{ + UpdatedAt: tag.UpdatedAt, ID: tag.ID, TagCode: tag.TagCode, Status: tag.Status, diff --git a/frontend/templates/location.html b/frontend/templates/location.html index 1521b20..8fe12a0 100644 --- a/frontend/templates/location.html +++ b/frontend/templates/location.html @@ -26,7 +26,7 @@

About your {{if .Data.ItemType}}{{.Data.ItemType}}{{else}}item{{end}}

- {{if .Data.PhotoURL}}Your item{{end}} + {{if .Data.PhotoURL}}Your item{{end}}
{{if .Data.Name}}

{{.Data.Name}}

{{end}} {{if .Data.Address}}

{{.Data.Address}}

{{end}} diff --git a/frontend/templates/tag-edit-inline.html b/frontend/templates/tag-edit-inline.html index 26bf6b7..4ffa9bd 100644 --- a/frontend/templates/tag-edit-inline.html +++ b/frontend/templates/tag-edit-inline.html @@ -30,7 +30,7 @@
- {{if .PhotoUrl.Valid}}Photo{{end}} + {{if .PhotoUrl.Valid}}Photo{{end}}
diff --git a/frontend/templates/tag-edit.html b/frontend/templates/tag-edit.html index ae8daff..f5372ec 100644 --- a/frontend/templates/tag-edit.html +++ b/frontend/templates/tag-edit.html @@ -27,7 +27,7 @@
- Photo + Photo

Choose a photo and press Save. If you choose nothing, the current photo is kept.

diff --git a/frontend/templates/tag-public.html b/frontend/templates/tag-public.html index 3276867..ee7b6e1 100644 --- a/frontend/templates/tag-public.html +++ b/frontend/templates/tag-public.html @@ -37,7 +37,7 @@
{{if .Data.PhotoUrl.Valid}} - Item photo + Item photo {{end}} {{if .Data.Description.Valid}}

{{.Data.Description.String}}