mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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:
@ -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.
|
||||
|
Reference in New Issue
Block a user