···
log.Printf("getting profile data for %s: %s", did, err)
60
-
followersCount, followingCount, err := db.GetFollowerFollowingCount(s.db, did)
60
+
followStats, err := db.GetFollowerFollowingCount(s.db, did)
log.Printf("getting follow stats for %s: %s", did, err)
···
UserHandle: ident.Handle.String(),
FollowStatus: followStatus,
79
-
FollowersCount: followersCount,
80
-
FollowingCount: followingCount,
79
+
FollowersCount: followStats.Followers,
80
+
FollowingCount: followStats.Following,
···
211
+
loggedInUser := pageWithProfile.LoggedInUser
follows, err := fetchFollows(s.db, id.DID.String())
···
219
+
return &FollowsPageParams{
220
+
LoggedInUser: loggedInUser,
221
+
Follows: []pages.FollowCard{},
222
+
Card: pageWithProfile.Card,
followDids := make([]string, 0, len(follows))
···
profiles, err := db.GetProfiles(s.db, db.FilterIn("did", followDids))
log.Printf("getting profile for %s: %s", followDids, err)
232
-
loggedInUser := pageWithProfile.LoggedInUser
236
+
followStatsMap, err := db.GetFollowerFollowingCounts(s.db, followDids)
238
+
log.Printf("getting follow counts for %s: %s", followDids, err)
var loggedInUserFollowing map[string]struct{}
following, err := db.GetFollowing(s.db, loggedInUser.Did)
···
followCards := make([]pages.FollowCard, 0, len(follows))
for _, did := range followDids {
249
-
followersCount, followingCount, err := db.GetFollowerFollowingCount(s.db, did)
251
-
log.Printf("getting follow stats for %s: %s", did, err)
257
+
followStats, exists := followStatsMap[did]
259
+
followStats = db.FollowStats{}
followStatus := db.IsNotFollowing
if loggedInUserFollowing != nil {
···
followCards = append(followCards, pages.FollowCard{
FollowStatus: followStatus,
271
-
FollowersCount: followersCount,
272
-
FollowingCount: followingCount,
279
+
FollowersCount: followStats.Followers,
280
+
FollowingCount: followStats.Following,
···
func (s *State) followersPage(w http.ResponseWriter, r *http.Request) {
followPage := s.followPage(w, r, db.GetFollowers, func(f db.Follow) string { return f.UserDid })
294
+
if followPage == nil {
s.pages.FollowersPage(w, pages.FollowersPageParams{
LoggedInUser: followPage.LoggedInUser,
···
func (s *State) followingPage(w http.ResponseWriter, r *http.Request) {
followPage := s.followPage(w, r, db.GetFollowing, func(f db.Follow) string { return f.SubjectDid })
307
+
if followPage == nil {
s.pages.FollowingPage(w, pages.FollowingPageParams{
LoggedInUser: followPage.LoggedInUser,