From 3023ff3104f7a2c950585c6b00c3a9e44401f551 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Sun, 7 Jun 2026 21:27:32 +0100 Subject: [PATCH] appview/timeline: implement global/following toggle Signed-off-by: oppiliappan --- appview/pages/pages.go | 1 + .../timeline/fragments/timeline.html | 40 ++++++++++++++++--- appview/state/timeline.go | 6 +-- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 974c4856..c2a8c559 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -416,6 +416,7 @@ type TimelineParams struct { VouchSuggestions []models.VouchSuggestion Notifications []*models.NotificationWithEntity Recents []RecentItem + FollowingOnly bool // ShowNewsletter controls whether the newsletter widget/CTA is rendered. // For logged-in users it reflects their newsletter_preferences row; for // anonymous visitors it is always true (dismissal falls back to diff --git a/appview/pages/templates/timeline/fragments/timeline.html b/appview/pages/templates/timeline/fragments/timeline.html index 274da2be..64fb55d9 100644 --- a/appview/pages/templates/timeline/fragments/timeline.html +++ b/appview/pages/templates/timeline/fragments/timeline.html @@ -1,9 +1,39 @@ {{ define "timeline/fragments/timeline" }} -
-

- {{ i "gallery-vertical" "size-4 flex-shrink-0" }} - Timeline -

+
+
{{ range $i, $g := .Timeline }} diff --git a/appview/state/timeline.go b/appview/state/timeline.go index 7290b260..c81a08dc 100644 --- a/appview/state/timeline.go +++ b/appview/state/timeline.go @@ -49,14 +49,13 @@ func (s *State) HomeOrTimeline(w http.ResponseWriter, r *http.Request) { func (s *State) Timeline(w http.ResponseWriter, r *http.Request) { user := s.oauth.GetMultiAccountUser(r) - // TODO: set this flag based on the UI - filtered := false + followingOnly := r.URL.Query().Get("following") == "true" && user != nil var userDid string if user != nil { userDid = user.Did } - timeline, err := db.MakeTimeline(s.db, 50, userDid, filtered) + timeline, err := db.MakeTimeline(s.db, 50, userDid, followingOnly) if err != nil { s.logger.Error("failed to make timeline", "err", err) s.pages.Notice(w, "timeline", "Uh oh! Failed to load timeline.") @@ -124,6 +123,7 @@ func (s *State) Timeline(w http.ResponseWriter, r *http.Request) { VouchSuggestions: vouchSuggestions, Notifications: notifications, Recents: recents, + FollowingOnly: followingOnly, ShowNewsletter: s.showNewsletter(user), }) } -- 2.51.2