back interdiff of round #1 and #0

appview: allow timeline db queries to be filterable by users follows #626

closed
opened by willdot.net targeting master from willdot.net/tangled-core: feat/filter-user-timeline

Signed-off-by: Will Andrews did:plc:dadhhalkfcq3gucaq25hjqon

files
appview
db
pages
templates
timeline
fragments
state
ERROR
appview/db/timeline.go

Failed to calculate interdiff for this file.

REVERTED
appview/state/state.go
···
if user != nil {
userDid = user.Did
}
+
timeline, err := db.MakeTimeline(s.db, 50, userDid)
-
timeline, err := db.MakeTimeline(s.db, 50, userDid, false)
if err != nil {
log.Println(err)
s.pages.Notice(w, "timeline", "Uh oh! Failed to load timeline.")
NEW
appview/pages/pages.go
···
LoggedInUser *oauth.User
Timeline []models.TimelineEvent
Repos []models.Repo
+
Filtered bool
}
func (p *Pages) Timeline(w io.Writer, params TimelineParams) error {
NEW
appview/pages/templates/timeline/fragments/timeline.html
···
{{ define "timeline/fragments/timeline" }}
<div class="py-4">
-
<div class="px-6 pb-4">
-
<p class="text-xl font-bold dark:text-white">Timeline</p>
+
+
<div class="flex gap-2 px-6 pb-4">
+
<div>
+
<p class="text-xl font-bold dark:text-white">Timeline</p>
+
</div>
+
{{ if .LoggedInUser }}
+
<div>
+
{{ if .Filtered }}
+
<a href="/timeline" class="hover:underline text-sm">
+
Show All
+
</a>
+
{{ else }}
+
<a href="/timeline?filtered=true" class="hover:underline text-sm">
+
Show following only
+
</a>
+
{{ end }}
+
</div>
+
{{ end }}
</div>
<div class="flex flex-col gap-4">