add support for status edits in the database, and update status dereferencer to handle them

This commit is contained in:
kim 2024-11-13 13:51:03 +00:00
commit 3e131f5da6
21 changed files with 623 additions and 172 deletions

View file

@ -52,7 +52,7 @@ func emojiChanged(existing, latest *gtsmodel.Emoji) bool {
// pollChanged returns whether a poll has changed in way that
// indicates that this should be an entirely new poll. i.e. if
// the available options have changed, or the expiry has increased.
// the available options have changed, or the expiry has changed.
func pollChanged(existing, latest *gtsmodel.Poll) bool {
return !slices.Equal(existing.Options, latest.Options) ||
!existing.ExpiresAt.Equal(latest.ExpiresAt)
@ -70,3 +70,12 @@ func pollUpdated(existing, latest *gtsmodel.Poll) bool {
func pollJustClosed(existing, latest *gtsmodel.Poll) bool {
return existing.ClosedAt.IsZero() && latest.Closed()
}
// statusChanged returns whether a status has changed in a way that
// indicates that existing should be snapshotted for version history.
func statusChanged(existing, latest *gtsmodel.Status) bool {
return !existing.UpdatedAt.Equal(latest.UpdatedAt) ||
existing.Content != latest.Content ||
existing.ContentWarning != latest.ContentWarning ||
!slices.Equal(existing.AttachmentIDs, latest.AttachmentIDs)
}