From a0357b599e646fb8018d746a537fa1073170277d Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Fri, 10 Apr 2026 13:06:49 +0900 Subject: [PATCH] appview: add comment to strings Signed-off-by: Seongmin Lee --- appview/pages/pages.go | 1 + appview/pages/templates/strings/string.html | 57 +++++++++++++++++++++ appview/strings/strings.go | 6 +++ 3 files changed, 64 insertions(+) diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 27673b97..9e21f97c 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -1595,6 +1595,7 @@ type SingleStringParams struct { IsStarred bool StarCount int Owner identity.Identity + CommentList []models.CommentListItem } func (p *Pages) SingleString(w io.Writer, params SingleStringParams) error { diff --git a/appview/pages/templates/strings/string.html b/appview/pages/templates/strings/string.html index f0fd65f1..f46d8d59 100644 --- a/appview/pages/templates/strings/string.html +++ b/appview/pages/templates/strings/string.html @@ -94,4 +94,61 @@ {{ template "fragments/multiline-select" }} +
+ {{ + template "fragments/comment/commentList" + (dict + "LoggedInUser" .LoggedInUser + "CommentList" .CommentList) + }} + {{ template "newComment" . }} +
+{{ end }} + +{{ define "newComment" }} + {{ if .LoggedInUser }} +
+ +
+
+ {{ template "user/fragments/picHandleLink" .LoggedInUser.Did }} +
+ +
+
+
+ +
+
+ {{ else }} +
+ + sign up + + or + login + to add to the discussion +
+ {{ end }} {{ end }} diff --git a/appview/strings/strings.go b/appview/strings/strings.go index 1c6627ac..f2465e89 100644 --- a/appview/strings/strings.go +++ b/appview/strings/strings.go @@ -156,6 +156,11 @@ func (s *Strings) contents(w http.ResponseWriter, r *http.Request) { isStarred = db.GetStarStatus(s.Db, user.Active.Did, string.AtUri()) } + comments, err := db.GetComments(s.Db, orm.FilterEq("subject_uri", string.AtUri())) + if err != nil { + l.Error("failed to get comments", "err", err) + } + s.Pages.SingleString(w, pages.SingleStringParams{ LoggedInUser: user, RenderToggle: renderToggle, @@ -165,6 +170,7 @@ func (s *Strings) contents(w http.ResponseWriter, r *http.Request) { IsStarred: isStarred, StarCount: starCount, Owner: id, + CommentList: models.NewCommentList(comments), }) } -- 2.51.2