Address follow-up review: cheaper avatars, list limits, less chatter.

Switch avatar resize to ApproxBiLinear, cap hunt/profile/admin list queries, drop redundant admin/profile lookups, dedupe CI on app PRs, and refresh stale todo.md notes.
This commit is contained in:
2026-08-22 09:55:32 -07:00
parent 1a8c4eda14
commit 96b0ce795a
13 changed files with 83 additions and 57 deletions
+1 -6
View File
@@ -48,12 +48,7 @@ func (s *Server) handleAdminSetRole(w http.ResponseWriter, r *http.Request) {
}
id := chi.URLParam(r, "id")
role := store.Role(r.PostFormValue("role"))
_, err := s.store.UserByID(r.Context(), id)
if err != nil {
http.Error(w, "could not update role", http.StatusBadRequest)
return
}
err = s.store.SetUserRole(r.Context(), id, role)
err := s.store.SetUserRole(r.Context(), id, role)
if errors.Is(err, store.ErrLastAdmin) {
users, listErr := s.store.ListUsers(r.Context())
if listErr != nil {
+1 -4
View File
@@ -208,7 +208,7 @@ func fitAvatar(img image.Image, maxDim int) image.Image {
nh = 1
}
dst := image.NewRGBA(image.Rect(0, 0, nw, nh))
draw.CatmullRom.Scale(dst, dst.Bounds(), img, b, draw.Over, nil)
draw.ApproxBiLinear.Scale(dst, dst.Bounds(), img, b, draw.Over, nil)
return dst
}
@@ -229,9 +229,6 @@ func (s *Server) renderProfile(w http.ResponseWriter, r *http.Request, u *store.
http.Error(w, "could not load questions", http.StatusInternalServerError)
return
}
if fresh, e := s.store.UserByID(r.Context(), u.ID); e == nil {
u = fresh
}
p := s.basePage(r, "Profile")
p.User = u
s.exec(w, "profile", profilePage{