From 3219e488e4c60a89b675a5d9d38f3159a9132bed Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 28 Apr 2026 11:24:29 +0100 Subject: [PATCH] appview/pages: add DID <-> string casts where necessary Signed-off-by: oppiliappan --- appview/pages/funcmap.go | 5 +++++ .../templates/repo/issues/fragments/commentList.html | 4 ++-- .../templates/repo/issues/fragments/issueListing.html | 2 +- appview/pages/templates/repo/issues/issue.html | 2 +- .../templates/repo/pulls/fragments/pullHeader.html | 2 +- appview/pages/templates/repo/pulls/pull.html | 4 ++-- appview/pages/templates/repo/pulls/pulls.html | 2 +- appview/pages/templates/user/fragments/picLink.html | 2 +- .../pages/templates/user/fragments/vouchTooltip.html | 4 ++-- appview/pulls/pulls.go | 10 ++++++++-- 10 files changed, 24 insertions(+), 13 deletions(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 9bce3fa6..5340ca5a 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -23,6 +23,7 @@ import ( chromahtml "github.com/alecthomas/chroma/v2/formatters/html" "github.com/alecthomas/chroma/v2/lexers" "github.com/alecthomas/chroma/v2/styles" + "github.com/bluesky-social/indigo/atproto/syntax" "github.com/dustin/go-humanize" "github.com/dustin/go-humanize/english" "github.com/go-enry/go-enry/v2" @@ -504,6 +505,10 @@ func (p *Pages) funcMap() template.FuncMap { "PdsUserDomain": p.pdsCfg.UserDomain, } }, + "did": func(s string) syntax.DID { + // cast to DID + return syntax.DID(s) + }, } } diff --git a/appview/pages/templates/repo/issues/fragments/commentList.html b/appview/pages/templates/repo/issues/fragments/commentList.html index 39492331..6a09db8a 100644 --- a/appview/pages/templates/repo/issues/fragments/commentList.html +++ b/appview/pages/templates/repo/issues/fragments/commentList.html @@ -15,7 +15,7 @@ "LoggedInUser" $root.LoggedInUser "Issue" $root.Issue "Comment" $comment.Self - "VouchRelationship" (index $root.VouchRelationships $comment.Self.Did) + "VouchRelationship" (index $root.VouchRelationships (did $comment.Self.Did)) ) }}
@@ -31,7 +31,7 @@ "LoggedInUser" $root.LoggedInUser "Issue" $root.Issue "Comment" $reply - "VouchRelationship" (index $root.VouchRelationships $reply.Did) + "VouchRelationship" (index $root.VouchRelationships (did $reply.Did)) ) }}
{{ end }} diff --git a/appview/pages/templates/repo/issues/fragments/issueListing.html b/appview/pages/templates/repo/issues/fragments/issueListing.html index 39fafb07..c3f4b489 100644 --- a/appview/pages/templates/repo/issues/fragments/issueListing.html +++ b/appview/pages/templates/repo/issues/fragments/issueListing.html @@ -27,7 +27,7 @@ - {{ template "user/fragments/picLink" (list .Did "size-6" (index $.VouchRelationships .Did)) }} + {{ template "user/fragments/picLink" (list .Did "size-6" (index $.VouchRelationships (did .Did))) }} {{ resolve .Did }} diff --git a/appview/pages/templates/repo/issues/issue.html b/appview/pages/templates/repo/issues/issue.html index 9b317552..21e13fb1 100644 --- a/appview/pages/templates/repo/issues/issue.html +++ b/appview/pages/templates/repo/issues/issue.html @@ -68,7 +68,7 @@ opened by - {{ template "user/fragments/picLink" (list .Issue.Did "size-6" (index .VouchRelationships .Issue.Did)) }} + {{ template "user/fragments/picLink" (list .Issue.Did "size-6" (index .VouchRelationships (did .Issue.Did))) }} {{ resolve .Issue.Did }} {{ if .Issue.Edited }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullHeader.html b/appview/pages/templates/repo/pulls/fragments/pullHeader.html index 36b6aae6..0fac3d06 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullHeader.html +++ b/appview/pages/templates/repo/pulls/fragments/pullHeader.html @@ -11,7 +11,7 @@ {{ template "repo/pulls/fragments/pullState" .Pull.State }} opened by - {{ template "user/fragments/picLink" (list .Pull.OwnerDid "size-6" (index .VouchRelationships .Pull.OwnerDid)) }} + {{ template "user/fragments/picLink" (list .Pull.OwnerDid "size-6" (index .VouchRelationships (did .Pull.OwnerDid))) }} {{ resolve .Pull.OwnerDid }} {{ template "repo/fragments/time" .Pull.Created }} diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 177d7148..72ec5278 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -300,7 +300,7 @@ flex gap-2 sticky top-0 z-20">
- {{ template "user/fragments/picLink" (list $root.Pull.OwnerDid "size-8" (index $root.VouchRelationships $root.Pull.OwnerDid)) }} + {{ template "user/fragments/picLink" (list $root.Pull.OwnerDid "size-8" (index $root.VouchRelationships (did $root.Pull.OwnerDid))) }}
@@ -630,7 +630,7 @@
- {{ template "user/fragments/picLink" (list $comment.OwnerDid "size-8" (index $root.VouchRelationships $comment.OwnerDid)) }} + {{ template "user/fragments/picLink" (list $comment.OwnerDid "size-8" (index $root.VouchRelationships (did $comment.OwnerDid))) }}
diff --git a/appview/pages/templates/repo/pulls/pulls.html b/appview/pages/templates/repo/pulls/pulls.html index 58b99b5b..b8bdc2af 100644 --- a/appview/pages/templates/repo/pulls/pulls.html +++ b/appview/pages/templates/repo/pulls/pulls.html @@ -82,7 +82,7 @@
{{ template "repo/pulls/fragments/pullState" $topPR.State }} - {{ template "user/fragments/picLink" (list $topPR.OwnerDid "size-6" (index $.VouchRelationships $topPR.OwnerDid)) }} + {{ template "user/fragments/picLink" (list $topPR.OwnerDid "size-6" (index $.VouchRelationships (did $topPR.OwnerDid))) }} {{ resolve $topPR.OwnerDid }} diff --git a/appview/pages/templates/user/fragments/picLink.html b/appview/pages/templates/user/fragments/picLink.html index 073af802..33d5629a 100644 --- a/appview/pages/templates/user/fragments/picLink.html +++ b/appview/pages/templates/user/fragments/picLink.html @@ -18,7 +18,7 @@ {{ if ne $did $vr.ViewerDid }}