ref: b74bf1e60f0bf1f4e044cff8ee4bf5e291b05d9e
parent: 9b803feba992a8825b7702b167793081385f43df
author: penny <penny@limitedideas.org>
date: Tue Sep 23 23:54:21 EDT 2025
break up some notification rendering logic
--- a/notifications.go
+++ b/notifications.go
@@ -68,20 +68,29 @@
fmt.Print(hc.RenderNotifications(notifications))
}
-func (hc *Hellclient) RenderNotifications(notifications []*mastodon.Notification) string {- var sb strings.Builder
+func (hc *Hellclient) RenderNotificationsArray(notifications []*mastodon.Notification) []string {+ var noticeTexts []string
status := func(Notification *mastodon.Notification, plaintext string) { notification := fmt.Sprintf("[%s] from <%s>: %s\n\n", Notification.Type, Notification.Account.Acct, plaintext)- sb.WriteString(hyphenate(notification))
+ noticeTexts = append(noticeTexts, hyphenate(notification))
}
other := func(Notification *mastodon.Notification) { notification := fmt.Sprintf("[%s] from <%s>\n\n", Notification.Type, Notification.Account.Acct)- sb.WriteString(hyphenate(notification))
+ noticeTexts = append(noticeTexts, hyphenate(notification))
}
hc.PrintNotificationsCustom(notifications, status, other)
+ return noticeTexts
+}
+
+func (hc *Hellclient) RenderNotifications(notifications []*mastodon.Notification) string {+ var sb strings.Builder
+ noticeTexts := hc.RenderNotificationsArray(notifications)
+ for _, text := range noticeTexts {+ sb.WriteString(text)
+ }
return sb.String()
}
--- a/pages.go
+++ b/pages.go
@@ -18,6 +18,11 @@
page *mastodon.Pagination
}
+type PageItem struct {+ itemtext string
+ lines int32
+}
+
func (noticeData *NotificationPages) String() string { if noticeData.page == nil { noticeData.page = &mastodon.Pagination{}--
⑨