[chore] replace statuses.updated_at column with statuses.edited_at (#3636)

* update statuses table to replace updated_at column with edited_at

* code comment

* better code comments, fix setting of status + edit + mention + poll database times

* fix log to logf call

* fix status.EditIDs not being carried over in dereferencer.encrichStatus()

* move status.EditID setting into handleStatusEdit()
This commit is contained in:
kim
2025-01-08 10:29:23 +00:00
committed by GitHub
parent e9bb7ddd3a
commit c013892ca2
23 changed files with 417 additions and 118 deletions

View File

@ -997,7 +997,7 @@ func (c *Converter) statusToAPIFilterResults(
// Key this status based on ID + last updated time,
// to ensure we always filter on latest version.
statusKey := s.ID + strconv.FormatInt(s.UpdatedAt.Unix(), 10)
statusKey := s.ID + strconv.FormatInt(s.UpdatedAt().Unix(), 10)
// Check if we have filterable fields cached for this status.
cache := c.state.Caches.StatusesFilterableFields
@ -1384,10 +1384,8 @@ func (c *Converter) baseStatusToFrontend(
InteractionPolicy: *apiInteractionPolicy,
}
// Only set edited_at if this is a non-boost-wrapper
// with an updated_at date different to creation date.
if !s.UpdatedAt.Equal(s.CreatedAt) && s.BoostOfID == "" {
timestamp := util.FormatISO8601(s.UpdatedAt)
if at := s.EditedAt; !at.IsZero() {
timestamp := util.FormatISO8601(at)
apiStatus.EditedAt = util.Ptr(timestamp)
}
@ -1522,8 +1520,8 @@ func (c *Converter) StatusToAPIEdits(ctx context.Context, status *gtsmodel.Statu
PollOptions: options,
PollVotes: votes,
AttachmentIDs: status.AttachmentIDs,
AttachmentDescriptions: nil, // no change from current
CreatedAt: status.UpdatedAt,
AttachmentDescriptions: nil, // no change from current
CreatedAt: status.UpdatedAt(), // falls back to creation
})
// Iterate through status edits, starting at newest.