Dan Anglin
f3d9d34f3c
This commit fixes the issue where the contents of a status is not shown when displayed on screen. For statuses made in GTS the Text field is populated with the plain text version of the content however this is unfortunately not the case for Mastodon statuses, therefore the Content field is used instead and the contents is processed with StripHTMLTags function to remove the HTML tags before printing.
29 lines
1 KiB
Go
29 lines
1 KiB
Go
package model
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/utilities"
|
|
)
|
|
|
|
type Timeline struct {
|
|
Name string
|
|
Statuses []Status
|
|
}
|
|
|
|
func (t Timeline) String() string {
|
|
var builder strings.Builder
|
|
|
|
separator := "────────────────────────────────────────────────────────────────────────────────"
|
|
|
|
builder.WriteString(utilities.HeaderFormat(t.Name) + "\n\n")
|
|
|
|
for _, status := range t.Statuses {
|
|
builder.WriteString(utilities.DisplayNameFormat(status.Account.DisplayName) + " (@" + status.Account.Username + ")\n")
|
|
builder.WriteString(utilities.WrapLines(utilities.StripHTMLTags(status.Content), "\n", 80) + "\n\n")
|
|
builder.WriteString(utilities.FieldFormat("ID:") + " " + status.ID + "\t" + utilities.FieldFormat("Created at:") + " " + utilities.FormatTime(status.CreatedAt) + "\n")
|
|
builder.WriteString(separator + "\n")
|
|
}
|
|
|
|
return builder.String()
|
|
}
|