Remove content and related fields from boosts (#3131)

These duplicate the content of the target and aren't necessary for anything.

- Stops copying some fields from target when boosting or processing a remote boost
- Adds a migration to null out existing duplicate data
- Updates tests
This commit is contained in:
Vyr Cossont 2024-07-23 12:51:57 -07:00 committed by GitHub
commit 86a59db711
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 19 deletions

View file

@ -26,6 +26,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
// EnrichAnnounce enriches the given boost wrapper status
@ -78,14 +79,12 @@ func (d *Dereferencer) EnrichAnnounce(
// original URI was an indirect link.
boost.BoostOfURI = target.URI
// Boosts are not considered sensitive even if their target is.
boost.Sensitive = util.Ptr(false)
// Populate remaining fields on
// the boost wrapper using target.
boost.Content = target.Content
boost.ContentWarning = target.ContentWarning
boost.ActivityStreamsType = target.ActivityStreamsType
boost.Sensitive = target.Sensitive
boost.Language = target.Language
boost.Text = target.Text
boost.BoostOfID = target.ID
boost.BoostOf = target
boost.BoostOfAccountID = target.AccountID