shithub: hell

Download patch

ref: 118353b4b4f9da491c1082050fb615696be7873a
parent: cfbae8c53a382717f982152d079c5cbad46a2275
author: penny <penny@limitedideas.org>
date: Fri Oct 17 21:18:20 EDT 2025

hide incoming statuses with subjects

--- a/mastodon.go
+++ b/mastodon.go
@@ -190,10 +190,10 @@
 func (hc *Hellclient) RenderPostPlaintext(post *mastodon.Status, ref postref) (selectedPost *mastodon.Status, plaintext string) {
 	if post.Reblog != nil {
 		selectedPost = post.Reblog
-		plaintext = "$username Reblogged $index $boostuser $boostcontent $boosted_media_descriptions"
+		plaintext = "$standard_reblog"
 	} else {
 		selectedPost = post
-		plaintext = "$standard_status"
+		plaintext = "$standard_or_subject"
 	}
 	formatter := &StatusFormatter{prefs: hc.preferences, status: post, postContext: &ref}
 	templater := newStatusTemplateRenderer(formatter)
--- a/renderer.go
+++ b/renderer.go
@@ -92,6 +92,21 @@
 	return fmt.Sprintf("%s%s>", is.postContext.prefix, is.postContext.ref)
 }
 
+// Stringer type for returning subjects or content
+type statusOrContent struct {
+	*StatusFormatter
+}
+
+// If status has a subject, return the subject
+// Otherwise return the content
+func (soc *statusOrContent) String() string {
+	if soc.status.SpoilerText != "" {
+		return fmt.Sprintf("[ %s ]", soc.status.SpoilerText)
+	}
+	return soc.statusContent(soc.status)
+}
+
+
 // Stringer for user who caused a notification
 type notificationUser struct {
 	*StatusFormatter
--- a/templater.go
+++ b/templater.go
@@ -21,6 +21,7 @@
 	template := &templateRenderer{
 		tempdefs: []*templateDefs{
 			{key: "content", stringer: &statusContent{sf}},
+			{key: "subject_or_content", stringer: &statusOrContent{sf}},
 			{key: "media_descriptions", stringer: &mediaDescriptions{sf}},
 			{key: "detail_line", stringer: &detailLine{sf}},
 			{key: "username", stringer: &username{sf}},
@@ -34,7 +35,8 @@
 	}
 	// macro templates
 	template.tempdefs = append(template.tempdefs, []*templateDefs{
-		{key: "standard_status", stringer: &standardStatus{template}},
+		{key: "standard_status", stringer: &standardStatus{template, false}},
+		{key: "standard_or_subject", stringer: &standardStatus{template, true}},
 		{key: "standard_reblog", stringer: &standardReblog{template}},
 		{key: "status_notif", stringer: &statusNotification{template}},
 		{key: "other_notif", stringer: &otherNotification{template}},
@@ -68,9 +70,14 @@
 // Renders a status line with username + content + media descriptions
 type standardStatus struct {
 	*templateRenderer
+	hidespoilers bool
 }
 
 func (ss *standardStatus) String() string {
+	if ss.hidespoilers {
+		line, _ := ss.renderRaw("$index $username $subject_or_content $media_descriptions")
+		return line
+	}
 	line, _ := ss.renderRaw("$index $username $content $media_descriptions")
 	return line
 }
--