diff --git a/appview/issues/issues.go b/appview/issues/issues.go index 463feda4..5480b561 100644 --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -100,6 +100,9 @@ func (rp *Issues) RepoSingleIssue(w http.ResponseWriter, r *http.Request) { } entities := []syntax.ATURI{issue.AtUri()} + for _, c := range issue.Comments { + entities = append(entities, c.AtUri()) + } reactions, err := db.ListReactionDisplayDataMap(rp.db, entities, 20) if err != nil { l.Error("failed to get reactions", "err", err) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index f1d6b6e2..6a8b9780 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -481,6 +481,22 @@ func (p *Pages) funcMap() template.FuncMap { "isGenerated": func(path string) bool { return enry.IsGenerated(path, nil) }, + // NOTE(boltless): I know... I hate doing this too + "asReactionMapMap": func(dict any) map[syntax.ATURI]map[models.ReactionKind]models.ReactionDisplayData { + if dict == nil { + return make(map[syntax.ATURI]map[models.ReactionKind]models.ReactionDisplayData) + } + m, _ := dict.(map[syntax.ATURI]map[models.ReactionKind]models.ReactionDisplayData) + return m + }, + "asReactionStatusMapMap": func(dict any) map[syntax.ATURI]map[models.ReactionKind]bool { + if dict == nil { + log.Println("returning empty map") + return make(map[syntax.ATURI]map[models.ReactionKind]bool) + } + m, _ := dict.(map[syntax.ATURI]map[models.ReactionKind]bool) + return m + }, // constant values used to define a template "const": func() map[string]any { return map[string]any{ diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 0581a2d8..8e7976be 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -1213,7 +1213,6 @@ func (p *Pages) EditIssueFragment(w io.Writer, params EditIssueParams) error { } type ThreadReactionFragmentParams struct { - ThreadAt syntax.ATURI Kind models.ReactionKind Count int Users []string @@ -1631,6 +1630,8 @@ type SingleStringParams struct { Owner identity.Identity CommentList []models.CommentListItem + Reactions map[syntax.ATURI]map[models.ReactionKind]models.ReactionDisplayData + UserReacted map[syntax.ATURI]map[models.ReactionKind]bool VouchRelationships map[syntax.DID]*models.VouchRelationship } diff --git a/appview/pages/templates/fragments/comment/commentBody.html b/appview/pages/templates/fragments/comment/commentBody.html index 1fcfe931..c5f820d7 100644 --- a/appview/pages/templates/fragments/comment/commentBody.html +++ b/appview/pages/templates/fragments/comment/commentBody.html @@ -1,7 +1,11 @@ {{ define "fragments/comment/commentBody" }}