[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
This commit is contained in:
tobi 2022-08-15 12:35:05 +02:00 committed by GitHub
commit ac6ed3d939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
376 changed files with 337942 additions and 298092 deletions

View file

@ -28,6 +28,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyAccount() *gtsmodel.Account {
@ -52,15 +53,15 @@ func happyAccount() *gtsmodel.Account {
DisplayName: "original zork (he/they)",
Fields: []gtsmodel.Field{},
Note: "hey yo this is my profile!",
Memorial: false,
Memorial: testrig.FalseBool(),
AlsoKnownAs: "",
MovedToAccountID: "",
Bot: false,
Bot: testrig.FalseBool(),
Reason: "I wanna be on this damned webbed site so bad! Please! Wow",
Locked: false,
Discoverable: true,
Locked: testrig.FalseBool(),
Discoverable: testrig.TrueBool(),
Privacy: gtsmodel.VisibilityPublic,
Sensitive: false,
Sensitive: testrig.FalseBool(),
Language: "en",
StatusFormat: "plain",
URI: "http://localhost:8080/users/the_mighty_zork",
@ -78,7 +79,7 @@ func happyAccount() *gtsmodel.Account {
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
HideCollections: testrig.FalseBool(),
SuspensionOrigin: "",
}
}

View file

@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyDomainBlock() *gtsmodel.DomainBlock {
@ -36,7 +37,7 @@ func happyDomainBlock() *gtsmodel.DomainBlock {
CreatedByAccountID: "01FEED79PRMVWPRMFHFQM8MJQN",
PrivateComment: "we don't like em",
PublicComment: "poo poo dudes",
Obfuscate: false,
Obfuscate: testrig.FalseBool(),
SubscriptionID: "",
}
}

View file

@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyEmoji() *gtsmodel.Emoji {
@ -73,9 +74,9 @@ func happyEmoji() *gtsmodel.Emoji {
ImageFileSize: 1024,
ImageStaticFileSize: 256,
ImageUpdatedAt: time.Now(),
Disabled: false,
Disabled: testrig.FalseBool(),
URI: "https://example.org/emojis/blob_test",
VisibleInPicker: true,
VisibleInPicker: testrig.TrueBool(),
CategoryID: "01FEE47ZH70PWDSEAVBRFNX325",
}
}

View file

@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyMediaAttachment() *gtsmodel.MediaAttachment {
@ -97,8 +98,8 @@ func happyMediaAttachment() *gtsmodel.MediaAttachment {
URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/small/01F8MH6NEM8D7527KZAECTCR76.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: false,
Avatar: testrig.FalseBool(),
Header: testrig.FalseBool(),
}
}

View file

@ -26,6 +26,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyStatus() *gtsmodel.Status {
@ -44,7 +45,7 @@ func happyStatus() *gtsmodel.Status {
Mentions: nil,
EmojiIDs: nil,
Emojis: nil,
Local: true,
Local: testrig.TrueBool(),
AccountID: "01FEBBQ4KEP3824WW61MF52638",
Account: nil,
AccountURI: "https://example.org/users/test_user",
@ -59,17 +60,17 @@ func happyStatus() *gtsmodel.Status {
BoostOfAccount: nil,
ContentWarning: "hello world test post",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: false,
Sensitive: testrig.FalseBool(),
Language: "en",
CreatedWithApplicationID: "01FEBBZHF4GFVRXSJVXD0JTZZ2",
CreatedWithApplication: nil,
Federated: true,
Boostable: true,
Replyable: true,
Likeable: true,
Federated: testrig.TrueBool(),
Boostable: testrig.TrueBool(),
Replyable: testrig.TrueBool(),
Likeable: testrig.TrueBool(),
ActivityStreamsType: ap.ObjectNote,
Text: "Test status! #hello",
Pinned: false,
Pinned: testrig.FalseBool(),
}
}
@ -127,7 +128,7 @@ func (suite *StatusValidateTestSuite) TestStatusApplicationID() {
err := validate.Struct(s)
suite.EqualError(err, "Key: 'Status.CreatedWithApplicationID' Error:Field validation for 'CreatedWithApplicationID' failed on the 'required_if' tag")
s.Local = false
s.Local = testrig.FalseBool()
err = validate.Struct(s)
suite.NoError(err)
}

View file

@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyTag() *gtsmodel.Tag {
@ -35,8 +36,8 @@ func happyTag() *gtsmodel.Tag {
URL: "https://example.org/tags/some_tag",
Name: "some_tag",
FirstSeenFromAccountID: "01FE91SR5P2GW06K3AJ98P72MT",
Useable: true,
Listable: true,
Useable: testrig.TrueBool(),
Listable: testrig.TrueBool(),
LastStatusAt: time.Now(),
}
}

View file

@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
"github.com/superseriousbusiness/gotosocial/testrig"
)
func happyUser() *gtsmodel.User {
@ -54,10 +55,10 @@ func happyUser() *gtsmodel.User {
ConfirmedAt: time.Now(),
ConfirmationSentAt: time.Time{},
UnconfirmedEmail: "",
Moderator: false,
Admin: false,
Disabled: false,
Approved: true,
Moderator: testrig.FalseBool(),
Admin: testrig.FalseBool(),
Disabled: testrig.FalseBool(),
Approved: testrig.TrueBool(),
}
}