Monorepo for Tangled tangled.org

appview: implement follower and following pages for users #484

merged opened by ptr.pet targeting master from [deleted fork]: followers-following-list
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:dfl62fgb7wtjj3fcbb72naae/sh.tangled.repo.pull/3lwawsuk3de22
+50 -50
Interdiff #9 #10
appview/db/profile.go

This file has not been changed.

appview/db/timeline.go

This file has not been changed.

+5 -5
appview/pages/funcmap.go
··· 271 "layoutCenter": func() string { 272 return "col-span-1 md:col-span-8 lg:col-span-6" 273 }, 274 - 275 - "normalizeForHtmlId": func(s string) string { 276 - // TODO: extend this to handle other cases? 277 - return strings.ReplaceAll(s, ":", "_") 278 - }, 279 } 280 } 281 282 "layoutCenter": func() string { 283 return "col-span-1 md:col-span-8 lg:col-span-6" 284 }, 285 } 286 } 287
··· 271 "layoutCenter": func() string { 272 return "col-span-1 md:col-span-8 lg:col-span-6" 273 }, 274 } 275 } 276 277 "layoutCenter": func() string { 278 return "col-span-1 md:col-span-8 lg:col-span-6" 279 }, 280 + 281 + "normalizeForHtmlId": func(s string) string { 282 + // TODO: extend this to handle other cases? 283 + return strings.ReplaceAll(s, ":", "_") 284 + }, 285 } 286 } 287
appview/pages/pages.go

This patch was likely rebased, as context lines do not match.

appview/pages/templates/timeline.html

This file has not been changed.

appview/pages/templates/user/followers.html

This file has not been changed.

appview/pages/templates/user/following.html

This file has not been changed.

appview/pages/templates/user/fragments/follow.html

This file has not been changed.

appview/pages/templates/user/fragments/followCard.html

This file has not been changed.

appview/pages/templates/user/fragments/profileCard.html

This file has not been changed.

appview/pages/templates/user/repos.html

This file has not been changed.

+31 -31
appview/state/profile.go
··· 122 Repos: pinnedRepos, 123 CollaboratingRepos: pinnedCollaboratingRepos, 124 Card: pages.ProfileCard{ 125 - UserDid: ident.DID.String(), 126 - UserHandle: ident.Handle.String(), 127 - Profile: profile, 128 - FollowStatus: followStatus, 129 - Followers: followers, 130 - Following: following, 131 }, 132 Punchcard: punchcard, 133 ProfileTimeline: timeline, ··· 141 Repos: pinnedRepos, 142 CollaboratingRepos: pinnedCollaboratingRepos, 143 Card: pages.ProfileCard{ 144 - UserDid: ident.DID.String(), 145 - UserHandle: ident.Handle.String(), 146 - Profile: profile, 147 - FollowStatus: followStatus, 148 - FollowersCount: followers, 149 - FollowingCount: following, 150 }, 151 Punchcard: punchcard, 152 ProfileTimeline: timeline, ··· 170 LoggedInUser: loggedInUser, 171 Repos: repos, 172 Card: pages.ProfileCard{ 173 - UserDid: ident.DID.String(), 174 - UserHandle: ident.Handle.String(), 175 - Profile: profile, 176 - FollowStatus: followStatus, 177 - Followers: followers, 178 - Following: following, 179 - }, 180 - }) 181 - } 182 - 183 - func (s *State) feedFromRequest(w http.ResponseWriter, r *http.Request) *feeds.Feed { 184 - ident, ok := r.Context().Value("resolvedId").(identity.Identity) 185 - if !ok { 186 - 187 - 188 - 189 - LoggedInUser: loggedInUser, 190 - Repos: repos, 191 - Card: pages.ProfileCard{ 192 UserDid: ident.DID.String(), 193 UserHandle: ident.Handle.String(), 194 Profile: profile, ··· 328 }) 329 } 330 331 func (s *State) feedFromRequest(w http.ResponseWriter, r *http.Request) *feeds.Feed { 332 ident, ok := r.Context().Value("resolvedId").(identity.Identity) 333 if !ok {
··· 122 Repos: pinnedRepos, 123 CollaboratingRepos: pinnedCollaboratingRepos, 124 Card: pages.ProfileCard{ 125 + UserDid: ident.DID.String(), 126 + UserHandle: ident.Handle.String(), 127 + Profile: profile, 128 + FollowStatus: followStatus, 129 + FollowersCount: followers, 130 + FollowingCount: following, 131 }, 132 Punchcard: punchcard, 133 ProfileTimeline: timeline, ··· 141 Repos: pinnedRepos, 142 CollaboratingRepos: pinnedCollaboratingRepos, 143 Card: pages.ProfileCard{ 144 + UserDid: ident.DID.String(), 145 + UserHandle: ident.Handle.String(), 146 + Profile: profile, 147 + FollowStatus: followStatus, 148 + Followers: followers, 149 + Following: following, 150 }, 151 Punchcard: punchcard, 152 ProfileTimeline: timeline, ··· 170 LoggedInUser: loggedInUser, 171 Repos: repos, 172 Card: pages.ProfileCard{ 173 UserDid: ident.DID.String(), 174 UserHandle: ident.Handle.String(), 175 Profile: profile, ··· 309 }) 310 } 311 312 + func (s *State) feedFromRequest(w http.ResponseWriter, r *http.Request) *feeds.Feed { 313 + ident, ok := r.Context().Value("resolvedId").(identity.Identity) 314 + if !ok { 315 + 316 + 317 + 318 + LoggedInUser: loggedInUser, 319 + Repos: repos, 320 + Card: pages.ProfileCard{ 321 + UserDid: ident.DID.String(), 322 + UserHandle: ident.Handle.String(), 323 + Profile: profile, 324 + FollowStatus: followStatus, 325 + Followers: followers, 326 + Following: following, 327 + }, 328 + }) 329 + } 330 + 331 func (s *State) feedFromRequest(w http.ResponseWriter, r *http.Request) *feeds.Feed { 332 ident, ok := r.Context().Value("resolvedId").(identity.Identity) 333 if !ok {
+14 -14
appview/strings/strings.go
··· 182 followStatus = db.GetFollowStatus(s.Db, loggedInUser.Did, id.DID.String()) 183 } 184 185 - followersCount, followingCount, err := db.GetFollowerFollowingCount(s.Db, id.DID.String()) 186 if err != nil { 187 l.Error("failed to get follow stats", "err", err) 188 } ··· 190 s.Pages.StringsDashboard(w, pages.StringsDashboardParams{ 191 LoggedInUser: s.OAuth.GetUser(r), 192 Card: pages.ProfileCard{ 193 - UserDid: id.DID.String(), 194 - UserHandle: id.Handle.String(), 195 - Profile: profile, 196 - FollowStatus: followStatus, 197 - FollowersCount: followersCount, 198 - FollowingCount: followingCount, 199 }, 200 Strings: all, 201 }) ··· 203 followStatus = db.GetFollowStatus(s.Db, loggedInUser.Did, id.DID.String()) 204 } 205 206 - followers, following, err := db.GetFollowerFollowingCount(s.Db, id.DID.String()) 207 if err != nil { 208 l.Error("failed to get follow stats", "err", err) 209 } ··· 211 s.Pages.StringsDashboard(w, pages.StringsDashboardParams{ 212 LoggedInUser: s.OAuth.GetUser(r), 213 Card: pages.ProfileCard{ 214 - UserDid: id.DID.String(), 215 - UserHandle: id.Handle.String(), 216 - Profile: profile, 217 - FollowStatus: followStatus, 218 - Followers: followers, 219 - Following: following, 220 }, 221 Strings: all, 222 })
··· 182 followStatus = db.GetFollowStatus(s.Db, loggedInUser.Did, id.DID.String()) 183 } 184 185 + followers, following, err := db.GetFollowerFollowingCount(s.Db, id.DID.String()) 186 if err != nil { 187 l.Error("failed to get follow stats", "err", err) 188 } ··· 190 s.Pages.StringsDashboard(w, pages.StringsDashboardParams{ 191 LoggedInUser: s.OAuth.GetUser(r), 192 Card: pages.ProfileCard{ 193 + UserDid: id.DID.String(), 194 + UserHandle: id.Handle.String(), 195 + Profile: profile, 196 + FollowStatus: followStatus, 197 + Followers: followers, 198 + Following: following, 199 }, 200 Strings: all, 201 }) ··· 203 followStatus = db.GetFollowStatus(s.Db, loggedInUser.Did, id.DID.String()) 204 } 205 206 + followersCount, followingCount, err := db.GetFollowerFollowingCount(s.Db, id.DID.String()) 207 if err != nil { 208 l.Error("failed to get follow stats", "err", err) 209 } ··· 211 s.Pages.StringsDashboard(w, pages.StringsDashboardParams{ 212 LoggedInUser: s.OAuth.GetUser(r), 213 Card: pages.ProfileCard{ 214 + UserDid: id.DID.String(), 215 + UserHandle: id.Handle.String(), 216 + Profile: profile, 217 + FollowStatus: followStatus, 218 + FollowersCount: followersCount, 219 + FollowingCount: followingCount, 220 }, 221 Strings: all, 222 })

History

14 rounds 6 comments
sign up or login to add to the discussion
1 commit
expand
cb75b373
appview: implement follower and following pages for users
expand 0 comments
pull request successfully merged
1 commit
expand
98413d89
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
118fb342
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
7a5c931a
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
773aa964
appview: implement follower and following pages for users
expand 1 comment
  • fixed timeline linking to wrong user (forgot to use subjectHandle instead of userHandle)
  • use ?tab= for followers / following like repo page does
  • fix repos opengraph url from /repos to ?tab=repos
1 commit
expand
ece60a35
appview: implement follower and following pages for users
expand 1 comment
  • added following / follower page links to timeline and follow cards
  • also added followers and following to profile tab switch case
1 commit
expand
a8bcde9d
appview: implement follower and following pages for users
expand 1 comment

using resolve in html instead of resolving handles in go code, and dedupped followers/followingPage into followPage

1 commit
expand
a285cd0f
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
3c2d8223
appview: implement follower and following pages for users
expand 1 comment

fixed some issues now that i got my dev setup working again

1 commit
expand
90b0a392
appview: implement follower and following pages for users
expand 1 comment

comments from #1 should be addressed now

on top of that changed GetProfiles to return a map instead of array, which seemed easier to do since it internally uses a map anyway and both places it's used in need it as a map

1 commit
expand
0dfc15e9
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
9643a898
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
cf9a2ce8
appview: implement follower and following pages for users
expand 1 comment

the pages themselves look pretty good for a start!

  • i'd like to add follower-following count to each item (to make these identical to the profile cards in the timeline)
  • this GetProfile call results in an N+1 query. we have a helper called GetProfiles to help with this, you can get profiles of multiple DIDs in one DB call. db/timeline.go has an example of the same.

overall, i'm loving this stack!

ptr.pet submitted #0
1 commit
expand
cbdbaf6d
appview: implement follower and following pages for users
expand 0 comments