more dicking abuot

This commit is contained in:
tobi 2025-04-17 18:32:25 +02:00
commit 6ef4cc36b2
9 changed files with 176 additions and 71 deletions

View file

@ -166,6 +166,12 @@ type WebStatus struct {
// after the "main" thread, so it and everything
// below it can be considered "replies".
ThreadFirstReply bool
// Sorted slice of StatusEdit times for
// this status, from latest to oldest.
// Only set if status has been edited.
// Last entry is always creation time.
EditTimeline []string `json:"-"`
}
/*

View file

@ -1217,6 +1217,31 @@ func (c *Converter) StatusToWebStatus(
// Mark local.
webStatus.Local = *s.Local
// Get edit history for this status.
if webStatus.EditedAt != nil {
if len(s.Edits) != len(s.EditIDs) {
s.Edits, err = c.state.DB.GetStatusEditsByIDs(ctx, s.EditIDs)
if err != nil && !errors.Is(err, db.ErrNoEntries) {
err := gtserror.Newf("db error getting status edits: %w", err)
return nil, err
}
}
for _, edit := range s.Edits {
webStatus.EditTimeline = append(
webStatus.EditTimeline,
util.FormatISO8601(edit.CreatedAt),
)
}
webStatus.EditTimeline = append(
webStatus.EditTimeline,
*webStatus.EditedAt,
)
slices.Reverse(webStatus.EditTimeline)
}
// Set additional templating
// variables on media attachments.