diff --git a/appview/db/vouch.go b/appview/db/vouch.go index 3acf054a..b2d00050 100644 --- a/appview/db/vouch.go +++ b/appview/db/vouch.go @@ -169,6 +169,23 @@ func DeleteVouchByRkey(e Execer, did, rkey string) error { return err } +func CountNetworkVouchTimeline(e Execer, viewerDid, profileDid string) (int, error) { + var count int + err := e.QueryRow( + `select count(*) from ( + select v.id from vouches v + where ( + v.subject_did = ? and v.did in (select subject_did from vouches where did = ? and kind = 'vouch') + ) or ( + v.did = ? and v.subject_did in (select subject_did from vouches where did = ? and kind = 'vouch') + ) + group by v.did, v.subject_did + )`, + profileDid, viewerDid, profileDid, viewerDid, + ).Scan(&count) + return count, err +} + func GetNetworkVouchTimeline(e Execer, viewerDid, profileDid string, page pagination.Page) ([]models.Vouch, error) { pageClause := "" if page.Limit > 0 { diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 92fa26e6..88a9b373 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -717,6 +717,7 @@ type ProfileVouchesParams struct { Suggestions []models.VouchSuggestion Card *ProfileCard Page pagination.Page + VouchCount int Active string EvidencePulls map[syntax.ATURI]*models.Pull EvidenceIssues map[syntax.ATURI]*models.Issue diff --git a/appview/pages/templates/user/vouches.html b/appview/pages/templates/user/vouches.html index 9cf51414..0c081b97 100644 --- a/appview/pages/templates/user/vouches.html +++ b/appview/pages/templates/user/vouches.html @@ -5,11 +5,11 @@