shithub: hell

Download patch

ref: c76596a23741363e47471ee53405586b0384bee5
parent: 95adfb5f6d502e0c75f07b181c74e97033ef66e2
author: penny <penny@limitedideas.org>
date: Wed Nov 12 20:58:59 EST 2025

fix polls for RTs

--- a/renderer.go
+++ b/renderer.go
@@ -228,24 +228,28 @@
 }
 
 func (poll *poll_renderer) String() string {
-	if poll.status.Poll != nil {
+	status := poll.status
+	if status.Reblog != nil {
+		status = status.Reblog
+	}
+	if status.Poll != nil {
 		var sb strings.Builder
 		sb.WriteString("\n")
-		total := poll.status.Poll.VotesCount
+		total := status.Poll.VotesCount
 		countstr := fmt.Sprintf("%v votes.", total)
 		if total == 0 { total = 1 }
 		index := "a"
 		show_choices := true
-		if poll.status.Poll.Voted {
+		if status.Poll.Voted {
 			show_choices = false
 		}
-		if poll.status.Poll.Expired {
+		if status.Poll.Expired {
 			show_choices = false
 		}
 
-		for i, item := range poll.status.Poll.Options {
+		for i, item := range status.Poll.Options {
 			voted := " "
-			if slices.Contains(poll.status.Poll.OwnVotes, i) {
+			if slices.Contains(status.Poll.OwnVotes, i) {
 				voted = " (+)"
 			}
 			if show_choices {
@@ -261,13 +265,13 @@
 			sb.WriteString(fmt.Sprintf("%s %v%%\n", percentBar, percent))
 		}
 		sb.WriteString(countstr)
-		if poll.status.Poll.Multiple {
+		if status.Poll.Multiple {
 			sb.WriteString(" multichoice.\n")
 		} else {
 			sb.WriteString("\n")
 		}
-		if !poll.status.Poll.Expired && !poll.status.Poll.ExpiresAt.IsZero() {
-			sb.WriteString(fmt.Sprintf("Poll closes in %s\n", time.Until(poll.status.Poll.ExpiresAt).Round(time.Second).String()))
+		if !status.Poll.Expired && !status.Poll.ExpiresAt.IsZero() {
+			sb.WriteString(fmt.Sprintf("Poll closes in %s\n", time.Until(status.Poll.ExpiresAt).Round(time.Second).String()))
 		}
 		return sb.String()
 	}
--