From 1502a542d0294dc112412bac210f4bfba36719dc Mon Sep 17 00:00:00 2001 From: Grace Kind Date: Mon, 20 Apr 2026 15:57:28 -0500 Subject: [PATCH] "Replied to you" in small post template --- src/js/templates/smallPost.template.js | 4 ++- .../templates/smallPost.template.test.js | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/js/templates/smallPost.template.js b/src/js/templates/smallPost.template.js index 4ac868a3..34de0031 100644 --- a/src/js/templates/smallPost.template.js +++ b/src/js/templates/smallPost.template.js @@ -129,7 +129,9 @@ export function smallPostTemplate({ ? html`
⤷ Replied to ${replyToAuthor - ? html` ${getDisplayName(replyToAuthor)}` + ? replyToAuthor.did === currentUser?.did + ? " you" + : html` ${getDisplayName(replyToAuthor)}` : " user"}
` : ""} diff --git a/tests/unit/specs/templates/smallPost.template.test.js b/tests/unit/specs/templates/smallPost.template.test.js index 3ebd0d19..7d62ffbf 100644 --- a/tests/unit/specs/templates/smallPost.template.test.js +++ b/tests/unit/specs/templates/smallPost.template.test.js @@ -278,6 +278,32 @@ t.describe("smallPostTemplate - reply-to label", (it) => { ); }); + it("should render 'Replied to you' when replyToAuthor is the current user", () => { + const result = smallPostTemplate({ + post: post, + ...baseProps, + showReplyToLabel: true, + replyToAuthor: { + did: "did:plc:test", + displayName: "Reply Author Name", + handle: "replyauthor.bsky.social", + }, + }); + const container = document.createElement("div"); + render(result, container); + const label = container.querySelector(".reply-to-author"); + assert(label !== null); + const text = label.textContent.replace(/\s+/g, " ").trim(); + assert( + text.includes("Replied to you"), + `expected "Replied to you" in "${text}"`, + ); + assert( + !text.includes("Reply Author Name"), + `did not expect display name in "${text}"`, + ); + }); + it("should render 'Replied to user' when replyToAuthor is missing", () => { const result = smallPostTemplate({ post: post, -- 2.51.2