diff options
author | 2022-08-15 12:35:05 +0200 | |
---|---|---|
committer | 2022-08-15 11:35:05 +0100 | |
commit | ac6ed3d939fe9dad81aadbd04541e905c625ca82 (patch) | |
tree | 6116baf25675837dc99f69c49b9fec2ff112ce5c /internal/typeutils/internal.go | |
parent | [frontend] Sensitive media spoilers (#752) (diff) | |
download | gotosocial-ac6ed3d939fe9dad81aadbd04541e905c625ca82.tar.xz |
[chore] Update bun / sqlite versions; update gtsmodels (#754)
* upstep bun and sqlite versions
* allow specific columns to be updated in the db
* only update necessary columns for user
* bit tidier
* only update necessary fields of media_attachment
* only update relevant instance fields
* update tests
* update only specific account columns
* use bool pointers on gtsmodels
includes attachment, status, account, user
* update columns more selectively
* test all default fields on new account insert
* updating remaining bools on gtsmodels
* initialize pointer fields when extracting AP emoji
* copy bools properly
* add copyBoolPtr convenience function + test it
* initialize false bool ptrs a bit more neatly
Diffstat (limited to 'internal/typeutils/internal.go')
-rw-r--r-- | internal/typeutils/internal.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/internal/typeutils/internal.go b/internal/typeutils/internal.go index 0d49ea6b2..ce2c942fd 100644 --- a/internal/typeutils/internal.go +++ b/internal/typeutils/internal.go @@ -11,15 +11,18 @@ import ( ) func (c *converter) FollowRequestToFollow(ctx context.Context, f *gtsmodel.FollowRequest) *gtsmodel.Follow { + showReblogs := *f.ShowReblogs + notify := *f.Notify + return >smodel.Follow{ ID: f.ID, CreatedAt: f.CreatedAt, UpdatedAt: f.UpdatedAt, AccountID: f.AccountID, TargetAccountID: f.TargetAccountID, - ShowReblogs: f.ShowReblogs, + ShowReblogs: &showReblogs, URI: f.URI, - Notify: f.Notify, + Notify: ¬ify, } } @@ -38,6 +41,13 @@ func (c *converter) StatusToBoost(ctx context.Context, s *gtsmodel.Status, boost local = false } + sensitive := *s.Sensitive + pinned := false // can't pin a boost + federated := *s.Federated + boostable := *s.Boostable + replyable := *s.Replyable + likeable := *s.Likeable + boostWrapperStatus := >smodel.Status{ ID: boostWrapperStatusID, URI: boostWrapperStatusURI, @@ -46,7 +56,7 @@ func (c *converter) StatusToBoost(ctx context.Context, s *gtsmodel.Status, boost // the boosted status is not created now, but the boost certainly is CreatedAt: time.Now(), UpdatedAt: time.Now(), - Local: local, + Local: &local, AccountID: boostingAccount.ID, AccountURI: boostingAccount.URI, @@ -64,16 +74,17 @@ func (c *converter) StatusToBoost(ctx context.Context, s *gtsmodel.Status, boost Content: s.Content, ContentWarning: s.ContentWarning, ActivityStreamsType: s.ActivityStreamsType, - Sensitive: s.Sensitive, + Sensitive: &sensitive, Language: s.Language, Text: s.Text, BoostOfID: s.ID, BoostOfAccountID: s.AccountID, Visibility: s.Visibility, - Federated: s.Federated, - Boostable: s.Boostable, - Replyable: s.Replyable, - Likeable: s.Likeable, + Pinned: &pinned, + Federated: &federated, + Boostable: &boostable, + Replyable: &replyable, + Likeable: &likeable, // attach these here for convenience -- the boosted status/account won't go in the DB // but they're needed in the processor and for the frontend. Since we have them, we can |