summaryrefslogtreecommitdiff
path: root/internal/typeutils/internaltofrontend.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-08 10:29:23 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-08 11:29:23 +0100
commitc013892ca22fe6bface8dc580571b2f0527cd1db (patch)
tree8eccf44e188b2d906aa0bafc9fb37640f1526844 /internal/typeutils/internaltofrontend.go
parent[feature] Create/update/remove domain permission subscriptions (#3623) (diff)
downloadgotosocial-c013892ca22fe6bface8dc580571b2f0527cd1db.tar.xz
[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()
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
-rw-r--r--internal/typeutils/internaltofrontend.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 9fb69b438..a90e88a70 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -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.