Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview/timeline: implement global/following toggle

Signed-off-by: oppiliappan <me@oppi.li>

author
oppiliappan
committer
Tangled
date (Jun 8, 2026, 5:59 PM +0300) commit 68814cdb parent 02fb64d6 change-id wysllzvv
+39 -8
+1
appview/pages/pages.go
··· 416 416 VouchSuggestions []models.VouchSuggestion 417 417 Notifications []*models.NotificationWithEntity 418 418 Recents []RecentItem 419 + FollowingOnly bool 419 420 // ShowNewsletter controls whether the newsletter widget/CTA is rendered. 420 421 // For logged-in users it reflects their newsletter_preferences row; for 421 422 // anonymous visitors it is always true (dismissal falls back to
+35 -5
appview/pages/templates/timeline/fragments/timeline.html
··· 1 1 {{ define "timeline/fragments/timeline" }} 2 - <div class="py-4"> 3 - <h3 class="text-base dark:text-white flex items-center gap-2 px-4 py-2"> 4 - {{ i "gallery-vertical" "size-4 flex-shrink-0" }} 5 - Timeline 6 - </h3> 2 + <div id="timeline-feed" class="py-4"> 3 + <div class="flex items-center justify-between pl-4 pb-4"> 4 + <h3 class="text-base dark:text-white flex items-center gap-2"> 5 + {{ i "gallery-vertical" "size-4 flex-shrink-0" }} 6 + Timeline 7 + </h3> 8 + {{ if .LoggedInUser }} 9 + <div class="btn-group grid grid-cols-2"> 10 + <a href="/timeline" 11 + hx-get="/timeline" 12 + hx-target="#timeline-feed" 13 + hx-select="#timeline-feed" 14 + hx-swap="outerHTML" 15 + hx-push-url="true" 16 + class="group btn-group-item inline-flex items-center justify-center {{ if not .FollowingOnly }}active{{ end }}"> 17 + <span class="relative inline-flex items-center justify-center"> 18 + <span class="group-[.htmx-request]:invisible">Global</span> 19 + {{ i "loader-circle" "size-3.5 animate-spin absolute hidden group-[.htmx-request]:block" }} 20 + </span> 21 + </a> 22 + <a href="/timeline?following=true" 23 + hx-get="/timeline?following=true" 24 + hx-target="#timeline-feed" 25 + hx-select="#timeline-feed" 26 + hx-swap="outerHTML" 27 + hx-push-url="true" 28 + class="group btn-group-item inline-flex items-center justify-center {{ if .FollowingOnly }}active{{ end }}"> 29 + <span class="relative inline-flex items-center justify-center"> 30 + <span class="group-[.htmx-request]:invisible">Following</span> 31 + {{ i "loader-circle" "size-3.5 animate-spin absolute hidden group-[.htmx-request]:block" }} 32 + </span> 33 + </a> 34 + </div> 35 + {{ end }} 36 + </div> 7 37 8 38 <div class="flex flex-col gap-4"> 9 39 {{ range $i, $g := .Timeline }}
+3 -3
appview/state/timeline.go
··· 49 49 func (s *State) Timeline(w http.ResponseWriter, r *http.Request) { 50 50 user := s.oauth.GetMultiAccountUser(r) 51 51 52 - // TODO: set this flag based on the UI 53 - filtered := false 52 + followingOnly := r.URL.Query().Get("following") == "true" && user != nil 54 53 55 54 var userDid string 56 55 if user != nil { 57 56 userDid = user.Did 58 57 } 59 - timeline, err := db.MakeTimeline(s.db, 50, userDid, filtered) 58 + timeline, err := db.MakeTimeline(s.db, 50, userDid, followingOnly) 60 59 if err != nil { 61 60 s.logger.Error("failed to make timeline", "err", err) 62 61 s.pages.Notice(w, "timeline", "Uh oh! Failed to load timeline.") ··· 124 123 VouchSuggestions: vouchSuggestions, 125 124 Notifications: notifications, 126 125 Recents: recents, 126 + FollowingOnly: followingOnly, 127 127 ShowNewsletter: s.showNewsletter(user), 128 128 }) 129 129 }