resolve dids in issues page
MODIFIED
appview/pages/pages.go
MODIFIED
appview/pages/pages.go
@@ -439,6 +439,7 @@ LoggedInUser *auth.UserRepoInfo RepoInfoActive stringIssues []db.Issue+ DidHandleMap map[string]string}func (p *Pages) RepoIssues(w io.Writer, params RepoIssuesParams) error {@@ -453,6 +454,7 @@ Active stringIssue db.IssueComments []db.CommentIssueOwnerHandle string+ DidHandleMap map[string]stringState string}
@@ -54,7 +54,7 @@ class="border border-gray-200 p-4"><div class="flex items-center gap-2 mb-2"><span class="text-gray-400 text-sm">- {{ .OwnerDid }}+ {{ index $.DidHandleMap .OwnerDid }}</span><span class="text-gray-500 text-sm">{{ .Created | timeFmt }}
@@ -39,7 +39,7 @@ <div class="text-sm flex gap-2 text-gray-400"><span>#{{ .IssueId }}</span><span class="before:content-['·']">opened by- {{ .OwnerDid }}+ {{ index $.DidHandleMap .OwnerDid }}</span></div></div>
MODIFIED
appview/state/repo.go
MODIFIED
appview/state/repo.go
@@ -545,6 +545,20 @@ if err != nil {log.Println("failed to resolve issue owner", err)}+ identsToResolve := make([]string, len(comments))+ for i, comment := range comments {+ identsToResolve[i] = comment.OwnerDid+ }+ resolvedIds := s.resolver.ResolveIdents(r.Context(), identsToResolve)+ didHandleMap := make(map[string]string)+ for _, identity := range resolvedIds {+ if !identity.Handle.IsInvalidHandle() {+ didHandleMap[identity.DID.String()] = fmt.Sprintf("@%s", identity.Handle.String())+ } else {+ didHandleMap[identity.DID.String()] = identity.DID.String()+ }+ }+s.pages.RepoSingleIssue(w, pages.RepoSingleIssueParams{LoggedInUser: user,RepoInfo: pages.RepoInfo{@@ -557,6 +571,7 @@ Issue: *issue,Comments: comments,IssueOwnerHandle: issueOwnerIdent.Handle.String(),+ DidHandleMap: didHandleMap,})}@@ -747,6 +762,20 @@ s.pages.Notice(w, "issues", "Failed to load issues. Try again later.")return}+ identsToResolve := make([]string, len(issues))+ for i, issue := range issues {+ identsToResolve[i] = issue.OwnerDid+ }+ resolvedIds := s.resolver.ResolveIdents(r.Context(), identsToResolve)+ didHandleMap := make(map[string]string)+ for _, identity := range resolvedIds {+ if !identity.Handle.IsInvalidHandle() {+ didHandleMap[identity.DID.String()] = fmt.Sprintf("@%s", identity.Handle.String())+ } else {+ didHandleMap[identity.DID.String()] = identity.DID.String()+ }+ }+s.pages.RepoIssues(w, pages.RepoIssuesParams{LoggedInUser: s.auth.GetUser(r),RepoInfo: pages.RepoInfo{@@ -755,7 +784,8 @@ OwnerHandle: f.OwnerHandle(),Name: f.RepoName,SettingsAllowed: settingsAllowed(s, user, f),},- Issues: issues,+ Issues: issues,+ DidHandleMap: didHandleMap,})return}