Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview/comment: on comment deletion, swap-oob a new comment header

the new header includes the correct timestamp, removes the hover buttons
etc.

Signed-off-by: oppiliappan <me@oppi.li>

author
oppiliappan
date (Jun 15, 2026, 10:03 AM +0100) commit c0cf6911 parent 61c7d67c change-id onzupppz
+30 -18
+11
appview/pages/pages.go
··· 1731 1731 return p.executePlain("fragments/comment/commentBody", w, params) 1732 1732 } 1733 1733 1734 + type CommentHeaderFragmentParams struct { 1735 + Comment models.Comment 1736 + Reactions map[models.ReactionKind]models.ReactionDisplayData 1737 + UserReacted map[models.ReactionKind]bool 1738 + HxSwapOob bool 1739 + } 1740 + 1741 + func (p *Pages) CommentHeaderFragment(w io.Writer, params CommentHeaderFragmentParams) error { 1742 + return p.executePlain("fragments/comment/commentHeader", w, params) 1743 + } 1744 + 1734 1745 type EditCommentFragmentParams struct { 1735 1746 Comment models.Comment 1736 1747 }
+12 -14
appview/pages/templates/fragments/comment/commentHeader.html
··· 2 2 <div 3 3 class="flex flex-wrap items-center gap-2 text-sm text-gray-500 dark:text-gray-400 " 4 4 hx-target="next .comment-body" 5 + id="comment-header-{{ .Comment.Rkey }}" 6 + {{ if .HxSwapOob }}hx-swap-oob="outerHTML"{{ end }} 5 7 > 6 8 {{ $handle := resolve .Comment.Did.String }} 7 9 <a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="/{{ $handle }}">{{ $handle }}</a> 8 - {{ template "hats" $ }} 9 10 <span class="before:content-['·']"></span> 10 11 {{ template "timestamp" . }} 11 12 {{ $isCommentOwner := and .LoggedInUser (eq .LoggedInUser.Did .Comment.Did.String) }} 12 13 {{ if and $isCommentOwner (not .Comment.Deleted) }} 13 - {{ if not .Comment.IsLegacy }} 14 - {{ template "editCommentBtn" . }} 15 - {{ end }} 16 - {{ template "deleteCommentBtn" . }} 14 + <div class="ml-auto flex items-center gap-4 opacity-0 group-hover/comment:opacity-100"> 15 + {{ if not .Comment.IsLegacy }} 16 + {{ template "editCommentBtn" . }} 17 + {{ end }} 18 + {{ template "deleteCommentBtn" . }} 19 + </div> 17 20 {{ end }} 18 21 </div> 19 22 {{ end }} 20 23 21 - {{ define "hats" }} 22 - {{ $isIssueAuthor := eq .Comment.Did .Issue.Did }} 23 - {{ if $isIssueAuthor }} 24 - (author) 25 - {{ end }} 26 - {{ end }} 27 - 28 24 {{ define "timestamp" }} 29 25 <a href="#comment-{{ .Comment.Rkey }}" 30 26 class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-400 hover:underline no-underline" ··· 41 37 42 38 {{ define "editCommentBtn" }} 43 39 <a 44 - class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer" 40 + class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer hover:no-underline no-underline" 45 41 hx-get="/comment/edit?aturi={{ .Comment.AtUri }}" 46 42 > 47 43 {{ i "pencil" "size-3 inline group-[.htmx-request]:hidden" }} 48 44 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 45 + edit 49 46 </a> 50 47 {{ end }} 51 48 52 49 {{ define "deleteCommentBtn" }} 53 50 <a 54 - class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer" 51 + class="text-red-500 dark:text-red-400 hover:text-red-600 hover:dark:text-red-300 flex gap-1 items-center group cursor-pointer hover:no-underline no-underline" 55 52 hx-delete="/comment?aturi={{ .Comment.AtUri }}" 56 53 hx-confirm="Are you sure you want to delete your comment?" 57 54 > 58 55 {{ i "trash-2" "size-3 inline group-[.htmx-request]:hidden" }} 59 56 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 57 + delete 60 58 </a> 61 59 {{ end }}
+2 -2
appview/pages/templates/fragments/comment/commentList.html
··· 42 42 {{ end }} 43 43 44 44 {{ define "topLevelComment" }} 45 - <div class="rounded px-6 py-4 bg-white dark:bg-gray-800 flex gap-2 "> 45 + <div class="rounded px-6 py-4 bg-white dark:bg-gray-800 flex gap-2 group/comment"> 46 46 <div class="flex-shrink-0"> 47 47 {{ template "user/fragments/picLink" (list .Comment.Did.String "size-8 mr-1" .VouchRelationship) }} 48 48 </div> ··· 54 54 {{ end }} 55 55 56 56 {{ define "replyComment" }} 57 - <div class="py-4 pr-4 w-full mx-auto flex gap-2 "> 57 + <div class="py-4 pr-4 w-full mx-auto flex gap-2 group/comment"> 58 58 <div class="flex-shrink-0"> 59 59 {{ template "user/fragments/picLink" (list .Comment.Did.String "size-8 mr-1" .VouchRelationship) }} 60 60 </div>
+1 -2
appview/pages/templates/repo/pulls/pull.html
··· 595 595 </summary> 596 596 <div> 597 597 {{ range $item.Comments }} 598 - {{/* template "submissionComment" . */}} 599 598 {{ template "comment" 600 599 (dict "LoggedInUser" $root.LoggedInUser 601 600 "Reactions" (index (asReactionMapMap $root.Reactions) .FeedCommentAtUri) ··· 636 635 {{ end }} 637 636 638 637 {{ define "comment" }} 639 - <div class="flex gap-2 -ml-4 py-4 w-full mx-auto"> 638 + <div class="flex gap-2 -ml-4 py-4 w-full mx-auto group/comment"> 640 639 <!-- left column: profile picture --> 641 640 <div class="flex-shrink-0 h-fit relative"> 642 641 {{ template "user/fragments/picLink" (list .Comment.Did.String "size-8") }}
+4
appview/state/comment.go
··· 460 460 s.pages.CommentBodyFragment(w, pages.CommentBodyFragmentParams{ 461 461 Comment: comment, 462 462 }) 463 + s.pages.CommentHeaderFragment(w, pages.CommentHeaderFragmentParams{ 464 + Comment: comment, 465 + HxSwapOob: true, 466 + }) 463 467 }