diff --git a/features/events/handlers.go b/features/events/handlers.go index 8a1c856..b453877 100644 --- a/features/events/handlers.go +++ b/features/events/handlers.go @@ -171,7 +171,7 @@ func (h *Handlers) Detail(w http.ResponseWriter, r *http.Request) { } if identity.IsLocal { - h.detailLocal(w, r, &ev, token, attendeeDIDs, stats, filter, page, milestoneBase, now) + h.detailLocal(w, r, &ev, token, attendeeDIDs, stats, filter, page, milestoneBase, now, identity.DID) return } @@ -518,7 +518,7 @@ func (h *Handlers) Detail(w http.ResponseWriter, r *http.Request) { func (h *Handlers) detailLocal(w http.ResponseWriter, r *http.Request, ev *event.Record, token string, attendeeDIDs []string, stats event.Stats, - filter string, page int, milestoneBase int, now time.Time) { + filter string, page int, milestoneBase int, now time.Time, viewerDID string) { // Build basic attendee list without PDS enrichment. var allAttendees []pages.Attendee @@ -617,7 +617,7 @@ func (h *Handlers) detailLocal(w http.ResponseWriter, r *http.Request, // For past events, load follow-ups from notes. if status == "complete" { - if allNotes, err := notes.ListAll(r.Context(), h.DB, ""); err == nil { + if allNotes, err := notes.ListAll(r.Context(), h.DB, viewerDID); err == nil { for _, n := range allNotes { if n.FollowUp { view.FollowUps = append(view.FollowUps, pages.FollowUpItem{ diff --git a/features/profile/handlers.go b/features/profile/handlers.go index 6892772..0dae8d8 100644 --- a/features/profile/handlers.go +++ b/features/profile/handlers.go @@ -156,28 +156,30 @@ func (h *Handlers) renderLocalProfile(w http.ResponseWriter, r *http.Request, lo } } - // Load earned badges from local cache - if earned, err := badge.ListEarned(ctx, h.DB, localID); err == nil { - for _, eb := range earned { - svg := badge.RenderSVG(badge.Design{ - Shape: eb.Shape, - PrimaryColor: eb.PrimaryColor, - AccentColor: eb.AccentColor, - RibbonColor: eb.RibbonColor, - Label: eb.Label, - }, 160) - view.Badges = append(view.Badges, pages.ProfileBadge{ - Name: eb.Name, - Description: eb.Description, - Shape: eb.Shape, - PrimaryColor: eb.PrimaryColor, - AccentColor: eb.AccentColor, - RibbonColor: eb.RibbonColor, - Label: eb.Label, - EarnedAt: eb.EarnedAt.Format("Jan 2, 2006"), - Message: eb.Message, - SVGPreview: svg, - }) + // Load earned badges from local cache (unless hidden) + if !hideBadges { + if earned, err := badge.ListEarned(ctx, h.DB, localID); err == nil { + for _, eb := range earned { + svg := badge.RenderSVG(badge.Design{ + Shape: eb.Shape, + PrimaryColor: eb.PrimaryColor, + AccentColor: eb.AccentColor, + RibbonColor: eb.RibbonColor, + Label: eb.Label, + }, 160) + view.Badges = append(view.Badges, pages.ProfileBadge{ + Name: eb.Name, + Description: eb.Description, + Shape: eb.Shape, + PrimaryColor: eb.PrimaryColor, + AccentColor: eb.AccentColor, + RibbonColor: eb.RibbonColor, + Label: eb.Label, + EarnedAt: eb.EarnedAt.Format("Jan 2, 2006"), + Message: eb.Message, + SVGPreview: svg, + }) + } } } diff --git a/internal/connection/connection_test.go b/internal/connection/connection_test.go index bcd5cdc..d6fd558 100644 --- a/internal/connection/connection_test.go +++ b/internal/connection/connection_test.go @@ -10,7 +10,7 @@ import ( ) func TestPut_RejectsNilSession(t *testing.T) { - _, _, err := Put(context.Background(), nil, Record{With: syntax.DID(didA)}) + _, _, err := Put(context.Background(), nil, nil, Record{With: syntax.DID(didA)}) if err == nil { t.Fatal("expected error for nil session") } @@ -21,7 +21,7 @@ func TestPut_RejectsNilSession(t *testing.T) { func TestPut_RejectsEmptyWith(t *testing.T) { sess := &oauth.ClientSession{Data: &oauth.ClientSessionData{AccountDID: syntax.DID(didA)}} - _, _, err := Put(context.Background(), sess, Record{With: ""}) + _, _, err := Put(context.Background(), sess, nil, Record{With: ""}) if err == nil { t.Fatal("expected error for missing target DID") } @@ -32,7 +32,7 @@ func TestPut_RejectsEmptyWith(t *testing.T) { func TestPut_RejectsSelfConnect(t *testing.T) { sess := &oauth.ClientSession{Data: &oauth.ClientSessionData{AccountDID: syntax.DID(didA)}} - _, _, err := Put(context.Background(), sess, Record{With: syntax.DID(didA)}) + _, _, err := Put(context.Background(), sess, nil, Record{With: syntax.DID(didA)}) if err == nil { t.Fatal("expected error for self-connect") }