[chore] deinterface the typeutils.Converter and update to use state structure (#2217)

* update typeconverter to use state structure

* deinterface the typeutils.TypeConverter -> typeutils.Converter

* finish copying over old type converter code comments

* fix cherry-pick merge issues, fix tests pointing to old typeutils interface type still
This commit is contained in:
kim
2023-09-23 17:44:11 +01:00
committed by GitHub
parent 1b848aa1e5
commit 8f67dd583d
119 changed files with 611 additions and 742 deletions

View File

@@ -26,7 +26,8 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/uris"
)
func (c *converter) FollowRequestToFollow(ctx context.Context, f *gtsmodel.FollowRequest) *gtsmodel.Follow {
// FollowRequestToFollow just converts a follow request into a follow, that's it! No bells and whistles.
func (c *Converter) FollowRequestToFollow(ctx context.Context, f *gtsmodel.FollowRequest) *gtsmodel.Follow {
showReblogs := *f.ShowReblogs
notify := *f.Notify
return &gtsmodel.Follow{
@@ -41,7 +42,8 @@ func (c *converter) FollowRequestToFollow(ctx context.Context, f *gtsmodel.Follo
}
}
func (c *converter) StatusToBoost(ctx context.Context, s *gtsmodel.Status, boostingAccount *gtsmodel.Account) (*gtsmodel.Status, error) {
// StatusToBoost wraps the given status into a boosting status.
func (c *Converter) StatusToBoost(ctx context.Context, s *gtsmodel.Status, boostingAccount *gtsmodel.Account) (*gtsmodel.Status, error) {
// the wrapper won't use the same ID as the boosted status so we generate some new UUIDs
accountURIs := uris.GenerateURIsForAccount(boostingAccount.Username)
boostWrapperStatusID := id.NewULID()