diff --git a/appview/db/vouch.go b/appview/db/vouch.go
index 088477a4..3acf054a 100644
--- a/appview/db/vouch.go
+++ b/appview/db/vouch.go
@@ -308,6 +308,15 @@ func GetVouchRelationship(e Execer, viewerDid, subjectDid syntax.DID) (*models.V
return batch[subjectDid], nil
}
+func IsVouchSkipped(e Execer, did, subjectDid string) (bool, error) {
+ var exists bool
+ err := e.QueryRow(
+ `select exists(select 1 from vouch_skips where did = ? and subject_did = ?)`,
+ did, subjectDid,
+ ).Scan(&exists)
+ return exists, err
+}
+
func SkipVouchSuggestion(e Execer, did, subjectDid string) error {
_, err := e.Exec(
`insert or ignore into vouch_skips (did, subject_did) values (?, ?)`,
diff --git a/appview/pages/pages.go b/appview/pages/pages.go
index efada8dc..352b2c8d 100644
--- a/appview/pages/pages.go
+++ b/appview/pages/pages.go
@@ -1384,6 +1384,7 @@ type RepoSinglePullParams struct {
LabelDefs map[string]*models.LabelDefinition
VouchRelationships map[syntax.DID]*models.VouchRelationship
+ VouchSkips map[syntax.DID]bool
}
func (p *Pages) RepoSinglePull(w io.Writer, params RepoSinglePullParams) error {
diff --git a/appview/pages/templates/repo/pulls/fragments/pullVouchNudge.html b/appview/pages/templates/repo/pulls/fragments/pullVouchNudge.html
new file mode 100644
index 00000000..9b56755d
--- /dev/null
+++ b/appview/pages/templates/repo/pulls/fragments/pullVouchNudge.html
@@ -0,0 +1,38 @@
+{{ define "repo/pulls/fragments/pullVouchNudge" }}
+ {{ $owner := .Pull.OwnerDid }}
+ {{ $vr := index .VouchRelationships (did $owner) }}
+ {{ $skipped := index .VouchSkips (did $owner) }}
+
+ {{ if and
+ .LoggedInUser
+ (ne .LoggedInUser.Did $owner)
+ (or .Pull.State.IsOpen .Pull.State.IsMerged)
+ (or (not $vr) $vr.IsEmpty)
+ (not $skipped) }}
+
+
+
+ {{ i "shield-question-mark" "size-4" }}
+ Would you like to vouch for
+
+
+ {{ resolve $owner }}
+
+ for their contribution?
+
+
+ dismiss
+ {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:block" }}
+
+
+ {{ template "user/fragments/vouch" (dict "VouchRelationship" $vr "Evidences" (list .Pull.AtUri.String) "PopoverId" (printf "vouch-nudge-modal-%s" (normalizeForHtmlId $owner))) }}
+
+
+ {{ end }}
+{{ end }}
diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html
index 05b4247c..8501dd26 100644
--- a/appview/pages/templates/repo/pulls/pull.html
+++ b/appview/pages/templates/repo/pulls/pull.html
@@ -80,9 +80,12 @@
{{ define "repoContentLayout" }}
-
- {{ block "repoContent" . }}{{ end }}
-
+
+
+ {{ block "repoContent" . }}{{ end }}
+
+ {{ template "repo/pulls/fragments/pullVouchNudge" . }}
+
{{ template "repo/fragments/labelPanel"
(dict "RepoInfo" $.RepoInfo
diff --git a/appview/pages/templates/timeline/fragments/vouchSuggestions.html b/appview/pages/templates/timeline/fragments/vouchSuggestions.html
index 45a80257..1c965506 100644
--- a/appview/pages/templates/timeline/fragments/vouchSuggestions.html
+++ b/appview/pages/templates/timeline/fragments/vouchSuggestions.html
@@ -19,7 +19,7 @@
{{ .Reason }}
- {{ template "user/fragments/vouch" . }}
+ {{ template "user/fragments/vouch" (dict "VouchRelationship" .VouchRelationship) }}
{{ end }}
diff --git a/appview/pages/templates/user/fragments/profileCard.html b/appview/pages/templates/user/fragments/profileCard.html
index 135301b6..efed19e8 100644
--- a/appview/pages/templates/user/fragments/profileCard.html
+++ b/appview/pages/templates/user/fragments/profileCard.html
@@ -109,7 +109,7 @@
{{ if ne .FollowStatus.String "IsSelf" }}
- {{ template "user/fragments/vouch" . }}
+ {{ template "user/fragments/vouch" (dict "VouchRelationship" .VouchRelationship) }}
{{ if .VouchRelationship }}
{{ if .VouchRelationship.IndirectVouches }}
diff --git a/appview/pages/templates/user/fragments/profilePopover.html b/appview/pages/templates/user/fragments/profilePopover.html
index 030a8eb1..b9fe30af 100644
--- a/appview/pages/templates/user/fragments/profilePopover.html
+++ b/appview/pages/templates/user/fragments/profilePopover.html
@@ -39,7 +39,7 @@
{{ if and .LoggedInUser (ne .FollowStatus.String "IsSelf") }}
{{ template "user/fragments/follow" . }}
- {{ template "user/fragments/vouchButton" . }}
+ {{ template "user/fragments/vouchButton" (dict "VouchRelationship" .VouchRelationship) }}
{{ if .VouchRelationship }}
@@ -54,6 +54,6 @@
{{/* render the vouch modal outside the popover content div so the popover api places it in the top layer correctly */}}
{{ if and .LoggedInUser (ne .FollowStatus.String "IsSelf") }}
- {{ template "user/fragments/vouchPopover" . }}
+ {{ template "user/fragments/vouchPopover" (dict "VouchRelationship" .VouchRelationship) }}
{{ end }}
{{ end }}
diff --git a/appview/pages/templates/user/fragments/vouch.html b/appview/pages/templates/user/fragments/vouch.html
index 375e502c..1a1c3dd1 100644
--- a/appview/pages/templates/user/fragments/vouch.html
+++ b/appview/pages/templates/user/fragments/vouch.html
@@ -1,6 +1,9 @@
{{ define "user/fragments/vouch" }}
+ {{ $vr := index . "VouchRelationship" }}
+ {{ $ev := index . "Evidences" }}
+ {{ $popoverId := index . "PopoverId" }}
{{ template "user/fragments/vouchButton" . }}
- {{ template "user/fragments/vouchPopover" . }}
+ {{ template "user/fragments/vouchPopover" (dict "VouchRelationship" $vr "Evidences" $ev "PopoverId" $popoverId) }}
{{ end }}
diff --git a/appview/pages/templates/user/fragments/vouchButton.html b/appview/pages/templates/user/fragments/vouchButton.html
index 5035c4e3..3b97c2c6 100644
--- a/appview/pages/templates/user/fragments/vouchButton.html
+++ b/appview/pages/templates/user/fragments/vouchButton.html
@@ -13,10 +13,12 @@
{{ with .VouchRelationship }}
{{ $userDid = .SubjectDid.String }}
{{ end }}
+{{ $popoverId := index . "PopoverId" }}
+{{ if not $popoverId }}{{ $popoverId = printf "vouch-modal-%s" (normalizeForHtmlId $userDid) }}{{ end }}
{{ if $isVouched }}
diff --git a/appview/pages/templates/user/fragments/vouchPopover.html b/appview/pages/templates/user/fragments/vouchPopover.html
index 3cd2cb58..254fea51 100644
--- a/appview/pages/templates/user/fragments/vouchPopover.html
+++ b/appview/pages/templates/user/fragments/vouchPopover.html
@@ -1,11 +1,13 @@
{{ define "user/fragments/vouchPopover" }}
+{{ $vr := index . "VouchRelationship" }}
+{{ $ev := index . "Evidences" }}
{{ $isVouched := false }}
{{ $isDenounced := false }}
{{ $isUndecided := false }}
-{{ if .VouchRelationship }}
- {{ if .VouchRelationship.IsDirectVouch }}
+{{ if $vr }}
+ {{ if $vr.IsDirectVouch }}
{{ $isVouched = true }}
- {{ else if .VouchRelationship.IsDirectDenounce }}
+ {{ else if $vr.IsDirectDenounce }}
{{ $isDenounced = true }}
{{ else }}
{{ $isUndecided = true }}
@@ -16,12 +18,14 @@
{{ $userIdent := "" }}
{{ $userDid := "" }}
-{{ with .VouchRelationship }}
+{{ with $vr }}
{{ $userDid = .SubjectDid.String }}
{{ $userIdent = resolve .SubjectDid.String }}
{{ end }}
+{{ $popoverId := index . "PopoverId" }}
+{{ if not $popoverId }}{{ $popoverId = printf "vouch-modal-%s" (normalizeForHtmlId $userDid) }}{{ end }}
@@ -34,7 +38,7 @@
Vouch for {{ $userIdent }}
- {{ with .VouchRelationship }}
+ {{ with $vr }}
{{ with .GetDirectVouch }}
You {{if $isVouched}}vouched{{else}}denounced{{end}} {{ $userIdent }} {{ relTimeFmt .CreatedAt }}.
You can change your decision below.
@@ -46,36 +50,39 @@
- {{ if .VouchRelationship }}
- {{ if .VouchRelationship.IndirectVouches }}
+ {{ if $vr }}
+ {{ if $vr.IndirectVouches }}
From your network:
- {{ template "user/fragments/networkVouches" .VouchRelationship }}
+ {{ template "user/fragments/networkVouches" $vr }}
{{ end }}
{{ end }}
+ {{ range $ev }}
+
+ {{ end }}
{{ $labelClass := "grid grid-cols-[auto_1fr_auto] items-center gap-2 rounded p-2 py- ring-1 ring-gray-200 dark:ring-gray-700 cursor-pointer" }}
- {{ template "user/fragments/vouch" . }}
+ {{ template "user/fragments/vouch" (dict "VouchRelationship" .VouchRelationship) }}