shithub: hell

Download patch

ref: 9d4705b5f7ba0539f5815e29a6aa87223be65044
parent: c3c38275f8510e450bc23478dec345fcec6371d4
author: penny <penny@limitedideas.org>
date: Wed Oct 15 09:54:47 EDT 2025

reply to mentioned users too

--- a/mastodon.go
+++ b/mastodon.go
@@ -115,16 +115,16 @@
 	toot.Visibility = postItem.Visibility
 
 	processStatusHints(&toot, &posttext)
-
-	if currentuser == postItem.Account.ID {
-		return &toot
-	}
 	var sb strings.Builder
-	sb.WriteString("@")
-	sb.WriteString(getUserString(postItem))
-	sb.WriteString(" ")
-	sb.WriteString(posttext)
+	if currentuser != postItem.Account.ID {
+		sb.WriteString(fmt.Sprintf("@%s ", getUserString(postItem)))
+	}
+	
+	for user := range postItem.Mentions {
+		sb.WriteString(fmt.Sprintf("@%s ", postItem.Mentions[user].Acct))
+	}
 
+	sb.WriteString(posttext)
 	toot.Status = sb.String()
 	return &toot
 }
--- a/renderer.go
+++ b/renderer.go
@@ -29,7 +29,7 @@
 
 // Returns the rendered content of a status
 func (st *StatusFormatter) statusContent(status *mastodon.Status) string {
-	renderedPost, plaintexts := st.postContext.renderStatus(status.Content, st.postContext.ref)
+	renderedPost, plaintexts := st.postContext.renderStatus(status.Content, st.postContext.prefix + st.postContext.ref)
 	renderedPost = html2text.HTML2Text(renderedPost)
 	for key, plaintext := range plaintexts {
 		renderedPost = strings.Replace(renderedPost, key, plaintext, 1)
@@ -194,8 +194,8 @@
 
 	for node := range doc.Descendants() {
 		if (node.Data == "pre" || node.Data == "") && node.FirstChild != nil {
-			preformats[fmt.Sprintf("%p%p", pr, node.FirstChild)] = node.FirstChild.Data
-			node.FirstChild.Data = fmt.Sprintf("%p%p", pr, node.FirstChild)
+			preformats[fmt.Sprintf("%p%p ", pr, node.FirstChild)] = node.FirstChild.Data
+			node.FirstChild.Data = fmt.Sprintf("%p%p ", pr, node.FirstChild)
 		}
 		if node.Data == "a" && node.Type == html.ElementNode {
 			ismention := false
--