From be3718f6e4c7bb229f9eb78b44c52d14399977cc Mon Sep 17 00:00:00 2001 From: Daenney Date: Mon, 7 Aug 2023 19:38:11 +0200 Subject: [PATCH] [chore] Use generic pointer function (#2080) This replaces the different $TypePtr functions with a generic implementation. --- internal/api/auth/authorize_test.go | 10 +- .../api/client/admin/reportresolve_test.go | 2 +- internal/api/client/admin/reportsget_test.go | 3 +- .../client/instance/instancepeersget_test.go | 3 +- .../api/client/reports/reportsget_test.go | 7 +- .../api/client/statuses/statuspin_test.go | 11 +- internal/db/bundb/admin.go | 9 +- internal/db/bundb/instance_test.go | 8 +- internal/db/bundb/notification_test.go | 4 +- internal/db/bundb/relationship_test.go | 4 +- internal/db/bundb/report_test.go | 3 +- internal/db/bundb/timeline_test.go | 14 +- internal/federation/federatingactor_test.go | 5 +- internal/processing/account/delete.go | 15 +- internal/processing/account/follow_test.go | 21 +- internal/processing/fromclientapi_test.go | 27 +- internal/processing/fromfederator_test.go | 25 +- internal/processing/media/getfile_test.go | 7 +- internal/typeutils/astointernal.go | 10 +- internal/util/ptr.go | 23 + internal/visibility/home_timeline_test.go | 85 +-- testrig/testmodels.go | 488 +++++++++--------- 22 files changed, 393 insertions(+), 391 deletions(-) create mode 100644 internal/util/ptr.go diff --git a/internal/api/auth/authorize_test.go b/internal/api/auth/authorize_test.go index ff65d041b..54df4c5e5 100644 --- a/internal/api/auth/authorize_test.go +++ b/internal/api/auth/authorize_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/api/auth" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type AuthAuthorizeTestSuite struct { @@ -51,8 +51,8 @@ func (suite *AuthAuthorizeTestSuite) TestAccountAuthorizeHandler() { mutateUserAccount: func(user *gtsmodel.User, account *gtsmodel.Account) []string { user.ConfirmedAt = time.Now() user.Email = user.UnconfirmedEmail - user.Approved = testrig.TrueBool() - user.Disabled = testrig.TrueBool() + user.Approved = util.Ptr(true) + user.Disabled = util.Ptr(true) return []string{"confirmed_at", "email", "approved", "disabled"} }, expectedStatusCode: http.StatusSeeOther, @@ -63,8 +63,8 @@ func (suite *AuthAuthorizeTestSuite) TestAccountAuthorizeHandler() { mutateUserAccount: func(user *gtsmodel.User, account *gtsmodel.Account) []string { user.ConfirmedAt = time.Now() user.Email = user.UnconfirmedEmail - user.Approved = testrig.TrueBool() - user.Disabled = testrig.FalseBool() + user.Approved = util.Ptr(true) + user.Disabled = util.Ptr(false) account.SuspendedAt = time.Now() return []string{"confirmed_at", "email", "approved", "disabled"} }, diff --git a/internal/api/client/admin/reportresolve_test.go b/internal/api/client/admin/reportresolve_test.go index 754dbb443..087080a70 100644 --- a/internal/api/client/admin/reportresolve_test.go +++ b/internal/api/client/admin/reportresolve_test.go @@ -138,7 +138,7 @@ func (suite *ReportResolveTestSuite) TestReportResolve2() { testToken := suite.testTokens["admin_account"] testUser := suite.testUsers["admin_account"] testReportID := suite.testReports["local_account_2_report_remote_account_1"].ID - var actionTakenComment *string = testrig.StringPtr("no action was taken, this is a frivolous report you boob") + var actionTakenComment *string = util.Ptr("no action was taken, this is a frivolous report you boob") report, err := suite.resolveReport(testAccount, testToken, testUser, testReportID, http.StatusOK, "", actionTakenComment) suite.NoError(err) diff --git a/internal/api/client/admin/reportsget_test.go b/internal/api/client/admin/reportsget_test.go index 4f29aa872..943e9711a 100644 --- a/internal/api/client/admin/reportsget_test.go +++ b/internal/api/client/admin/reportsget_test.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oauth" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -963,7 +964,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetResolvedTargetAccount() { testAccount := suite.testAccounts["admin_account"] testToken := suite.testTokens["admin_account"] testUser := suite.testUsers["admin_account"] - resolved := testrig.FalseBool() + resolved := util.Ptr(false) targetAccount := suite.testAccounts["local_account_2"] reports, link, err := suite.getReports(testAccount, testToken, testUser, http.StatusOK, "", resolved, "", targetAccount.ID, "", "", "", 20) diff --git a/internal/api/client/instance/instancepeersget_test.go b/internal/api/client/instance/instancepeersget_test.go index 70f625069..a2c81cc4e 100644 --- a/internal/api/client/instance/instancepeersget_test.go +++ b/internal/api/client/instance/instancepeersget_test.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/api/client/instance" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -231,7 +232,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetAllWithObfuscated() Domain: "omg.just.the.worst.org.ever", CreatedByAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", PublicComment: "just absolutely the worst, wowza", - Obfuscate: testrig.TrueBool(), + Obfuscate: util.Ptr(true), }) suite.NoError(err) diff --git a/internal/api/client/reports/reportsget_test.go b/internal/api/client/reports/reportsget_test.go index 709077f0d..d220dc94d 100644 --- a/internal/api/client/reports/reportsget_test.go +++ b/internal/api/client/reports/reportsget_test.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oauth" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -197,7 +198,7 @@ func (suite *ReportsGetTestSuite) TestGetReports4() { testAccount := suite.testAccounts["local_account_2"] testToken := suite.testTokens["local_account_2"] testUser := suite.testUsers["local_account_2"] - resolved := testrig.FalseBool() + resolved := util.Ptr(false) reports, link, err := suite.getReports(testAccount, testToken, testUser, http.StatusOK, resolved, "", "", "", "", 20) suite.NoError(err) @@ -252,7 +253,7 @@ func (suite *ReportsGetTestSuite) TestGetReports5() { testAccount := suite.testAccounts["local_account_1"] testToken := suite.testTokens["local_account_1"] testUser := suite.testUsers["local_account_1"] - resolved := testrig.TrueBool() + resolved := util.Ptr(true) reports, link, err := suite.getReports(testAccount, testToken, testUser, http.StatusOK, resolved, "", "", "", "", 20) suite.NoError(err) @@ -323,7 +324,7 @@ func (suite *ReportsGetTestSuite) TestGetReports7() { testAccount := suite.testAccounts["local_account_2"] testToken := suite.testTokens["local_account_2"] testUser := suite.testUsers["local_account_2"] - resolved := testrig.FalseBool() + resolved := util.Ptr(false) reports, link, err := suite.getReports(testAccount, testToken, testUser, http.StatusOK, resolved, "01F8MH5ZK5VRH73AKHQM6Y9VNX", "", "", "", 20) suite.NoError(err) diff --git a/internal/api/client/statuses/statuspin_test.go b/internal/api/client/statuses/statuspin_test.go index c7ed6e95d..034860031 100644 --- a/internal/api/client/statuses/statuspin_test.go +++ b/internal/api/client/statuses/statuspin_test.go @@ -36,6 +36,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/oauth" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -165,14 +166,14 @@ func (suite *StatusPinTestSuite) TestPinStatusTooManyPins() { PinnedAt: time.Now(), URL: "stub " + strconv.Itoa(i), URI: "stub " + strconv.Itoa(i), - Local: testrig.TrueBool(), + Local: util.Ptr(true), AccountID: testAccount.ID, AccountURI: testAccount.URI, Visibility: gtsmodel.VisibilityPublic, - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, status); err != nil { diff --git a/internal/db/bundb/admin.go b/internal/db/bundb/admin.go index fb1fb9d6c..723648a9e 100644 --- a/internal/db/bundb/admin.go +++ b/internal/db/bundb/admin.go @@ -36,6 +36,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/uris" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/uptrace/bun" "golang.org/x/crypto/bcrypt" ) @@ -198,17 +199,15 @@ func (a *adminDB) NewSignup(ctx context.Context, newSignup gtsmodel.NewSignup) ( user.Email = newSignup.Email } - trueBool := func() *bool { t := true; return &t } - if newSignup.Admin { // Make new user mod + admin. - user.Moderator = trueBool() - user.Admin = trueBool() + user.Moderator = util.Ptr(true) + user.Admin = util.Ptr(true) } if newSignup.PreApproved { // Mark new user as approved. - user.Approved = trueBool() + user.Approved = util.Ptr(true) } // Insert the user! diff --git a/internal/db/bundb/instance_test.go b/internal/db/bundb/instance_test.go index 580a7699b..a825a3341 100644 --- a/internal/db/bundb/instance_test.go +++ b/internal/db/bundb/instance_test.go @@ -25,7 +25,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type InstanceTestSuite struct { @@ -103,7 +103,7 @@ func (suite *InstanceTestSuite) TestGetInstanceModeratorAddressesZorkAsModerator // Promote zork to moderator role. testUser := >smodel.User{} *testUser = *suite.testUsers["local_account_1"] - testUser.Moderator = testrig.TrueBool() + testUser.Moderator = util.Ptr(true) if err := suite.db.UpdateUser(context.Background(), testUser, "moderator"); err != nil { suite.FailNow(err.Error()) } @@ -117,8 +117,8 @@ func (suite *InstanceTestSuite) TestGetInstanceModeratorAddressesNoAdmin() { // Demote admin from admin + moderator roles. testUser := >smodel.User{} *testUser = *suite.testUsers["admin_account"] - testUser.Admin = testrig.FalseBool() - testUser.Moderator = testrig.FalseBool() + testUser.Admin = util.Ptr(false) + testUser.Moderator = util.Ptr(false) if err := suite.db.UpdateUser(context.Background(), testUser, "admin", "moderator"); err != nil { suite.FailNow(err.Error()) } diff --git a/internal/db/bundb/notification_test.go b/internal/db/bundb/notification_test.go index 8bbea78ad..e27475476 100644 --- a/internal/db/bundb/notification_test.go +++ b/internal/db/bundb/notification_test.go @@ -28,7 +28,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/id" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) func (suite *NotificationTestSuite) spamNotifs() { @@ -70,7 +70,7 @@ func (suite *NotificationTestSuite) spamNotifs() { TargetAccountID: targetAccountID, OriginAccountID: originAccountID, StatusID: statusID, - Read: testrig.FalseBool(), + Read: util.Ptr(false), } if err := suite.db.Put(context.Background(), notif); err != nil { diff --git a/internal/db/bundb/relationship_test.go b/internal/db/bundb/relationship_test.go index cf2df5144..d7c93ff0e 100644 --- a/internal/db/bundb/relationship_test.go +++ b/internal/db/bundb/relationship_test.go @@ -28,7 +28,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/id" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type RelationshipTestSuite struct { @@ -892,7 +892,7 @@ func (suite *RelationshipTestSuite) TestUpdateFollow() { follow := >smodel.Follow{} *follow = *suite.testFollows["local_account_1_admin_account"] - follow.Notify = testrig.TrueBool() + follow.Notify = util.Ptr(true) if err := suite.db.UpdateFollow(ctx, follow, "notify"); err != nil { suite.FailNow(err.Error()) } diff --git a/internal/db/bundb/report_test.go b/internal/db/bundb/report_test.go index c5ec070e0..594b0b7aa 100644 --- a/internal/db/bundb/report_test.go +++ b/internal/db/bundb/report_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -88,7 +89,7 @@ func (suite *ReportTestSuite) TestPutReport() { TargetAccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", Comment: "another report", StatusIDs: []string{"01FVW7JHQFSFK166WWKR8CBA6M"}, - Forwarded: testrig.TrueBool(), + Forwarded: util.Ptr(true), } err := suite.db.PutReport(ctx, report) diff --git a/internal/db/bundb/timeline_test.go b/internal/db/bundb/timeline_test.go index 43407bc69..2bc9c9d0d 100644 --- a/internal/db/bundb/timeline_test.go +++ b/internal/db/bundb/timeline_test.go @@ -26,7 +26,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/id" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type TimelineTestSuite struct { @@ -52,20 +52,20 @@ func getFutureStatus() *gtsmodel.Status { EmojiIDs: []string{}, CreatedAt: theDistantFuture, UpdatedAt: theDistantFuture, - Local: testrig.TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } } diff --git a/internal/federation/federatingactor_test.go b/internal/federation/federatingactor_test.go index f0010152f..348d501d6 100644 --- a/internal/federation/federatingactor_test.go +++ b/internal/federation/federatingactor_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/federation" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -80,9 +81,9 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() { UpdatedAt: testrig.TimeMustParse("2022-06-02T12:22:21+02:00"), AccountID: testRemoteAccount.ID, TargetAccountID: testAccount.ID, - ShowReblogs: testrig.TrueBool(), + ShowReblogs: util.Ptr(true), URI: "http://fossbros-anonymous.io/users/foss_satan/follows/01G1TRWV4AYCDBX5HRWT2EVBCV", - Notify: testrig.FalseBool(), + Notify: util.Ptr(false), }) suite.NoError(err) diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go index dd5957531..d2483aeb1 100644 --- a/internal/processing/account/delete.go +++ b/internal/processing/account/delete.go @@ -31,6 +31,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/messages" + "github.com/superseriousbusiness/gotosocial/internal/util" "golang.org/x/crypto/bcrypt" ) @@ -427,10 +428,8 @@ func (p *Processor) deleteAccountPeripheral(ctx context.Context, account *gtsmod // names of all columns that are updated by it. func stubbifyAccount(account *gtsmodel.Account, origin string) []string { var ( - falseBool = func() *bool { b := false; return &b } - trueBool = func() *bool { b := true; return &b } - now = time.Now() - never = time.Time{} + now = time.Now() + never = time.Time{} ) account.FetchedAt = never @@ -444,17 +443,17 @@ func stubbifyAccount(account *gtsmodel.Account, origin string) []string { account.Fields = nil account.Note = "" account.NoteRaw = "" - account.Memorial = falseBool() + account.Memorial = util.Ptr(false) account.AlsoKnownAs = "" account.MovedToAccountID = "" account.Reason = "" - account.Discoverable = falseBool() + account.Discoverable = util.Ptr(false) account.StatusContentType = "" account.CustomCSS = "" account.SuspendedAt = now account.SuspensionOrigin = origin - account.HideCollections = trueBool() - account.EnableRSS = falseBool() + account.HideCollections = util.Ptr(true) + account.EnableRSS = util.Ptr(false) return []string{ "fetched_at", diff --git a/internal/processing/account/follow_test.go b/internal/processing/account/follow_test.go index 70a28eea2..ed6b62304 100644 --- a/internal/processing/account/follow_test.go +++ b/internal/processing/account/follow_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/suite" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" - "github.com/superseriousbusiness/gotosocial/testrig" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type FollowTestSuite struct { @@ -40,10 +40,9 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeBoth() { // UPDATE "follows" AS "follow" SET "show_reblogs" = FALSE, "notify" = TRUE, "updated_at" = '2023-04-09 11:42:39.424705+00:00' WHERE ("follow"."id" = '01F8PY8RHWRQZV038T4E8T9YK8') relationship, err := suite.accountProcessor.FollowCreate(ctx, requestingAccount, &apimodel.AccountFollowRequest{ ID: targetAccount.ID, - Reblogs: testrig.FalseBool(), - Notify: testrig.TrueBool(), + Reblogs: util.Ptr(false), + Notify: util.Ptr(true), }) - if err != nil { suite.FailNow(err.Error()) } @@ -62,9 +61,8 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifyIgnoreReblogs( // UPDATE "follows" AS "follow" SET "notify" = TRUE, "updated_at" = '2023-04-09 11:40:33.827858+00:00' WHERE ("follow"."id" = '01F8PY8RHWRQZV038T4E8T9YK8') relationship, err := suite.accountProcessor.FollowCreate(ctx, requestingAccount, &apimodel.AccountFollowRequest{ ID: targetAccount.ID, - Notify: testrig.TrueBool(), + Notify: util.Ptr(true), }) - if err != nil { suite.FailNow(err.Error()) } @@ -83,10 +81,9 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifySetReblogs() { // UPDATE "follows" AS "follow" SET "notify" = TRUE, "updated_at" = '2023-04-09 11:40:33.827858+00:00' WHERE ("follow"."id" = '01F8PY8RHWRQZV038T4E8T9YK8') relationship, err := suite.accountProcessor.FollowCreate(ctx, requestingAccount, &apimodel.AccountFollowRequest{ ID: targetAccount.ID, - Notify: testrig.TrueBool(), - Reblogs: testrig.TrueBool(), + Notify: util.Ptr(true), + Reblogs: util.Ptr(true), }) - if err != nil { suite.FailNow(err.Error()) } @@ -104,10 +101,9 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNothing() { // Trace logs should show no update query. relationship, err := suite.accountProcessor.FollowCreate(ctx, requestingAccount, &apimodel.AccountFollowRequest{ ID: targetAccount.ID, - Notify: testrig.FalseBool(), - Reblogs: testrig.TrueBool(), + Notify: util.Ptr(false), + Reblogs: util.Ptr(true), }) - if err != nil { suite.FailNow(err.Error()) } @@ -126,7 +122,6 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowSetNothing() { relationship, err := suite.accountProcessor.FollowCreate(ctx, requestingAccount, &apimodel.AccountFollowRequest{ ID: targetAccount.ID, }) - if err != nil { suite.FailNow(err.Error()) } diff --git a/internal/processing/fromclientapi_test.go b/internal/processing/fromclientapi_test.go index 808f02cd6..94068e192 100644 --- a/internal/processing/fromclientapi_test.go +++ b/internal/processing/fromclientapi_test.go @@ -30,6 +30,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/stream" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -63,20 +64,20 @@ func (suite *FromClientAPITestSuite) TestProcessStreamNewStatus() { EmojiIDs: []string{}, CreatedAt: testrig.TimeMustParse("2021-10-20T11:36:45Z"), UpdatedAt: testrig.TimeMustParse("2021-10-20T11:36:45Z"), - Local: testrig.TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: testrig.FalseBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(false), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } @@ -189,7 +190,7 @@ func (suite *FromClientAPITestSuite) TestProcessNewStatusWithNotification() { // that receiving account wants notifs when posting account posts. follow := >smodel.Follow{} *follow = *suite.testFollows["local_account_1_admin_account"] - follow.Notify = testrig.TrueBool() + follow.Notify = util.Ptr(true) if err := suite.db.UpdateFollow(ctx, follow); err != nil { suite.FailNow(err.Error()) } @@ -206,20 +207,20 @@ func (suite *FromClientAPITestSuite) TestProcessNewStatusWithNotification() { EmojiIDs: []string{}, CreatedAt: testrig.TimeMustParse("2021-10-20T11:36:45Z"), UpdatedAt: testrig.TimeMustParse("2021-10-20T11:36:45Z"), - Local: testrig.TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: testrig.FalseBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(false), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } diff --git a/internal/processing/fromfederator_test.go b/internal/processing/fromfederator_test.go index a981899d2..0b0e52811 100644 --- a/internal/processing/fromfederator_test.go +++ b/internal/processing/fromfederator_test.go @@ -32,6 +32,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/stream" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -110,10 +111,10 @@ func (suite *FromFederatorTestSuite) TestProcessReplyMention() { InReplyToAccountID: repliedAccount.ID, Visibility: gtsmodel.VisibilityUnlocked, ActivityStreamsType: ap.ObjectNote, - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.FalseBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(false), } wssStream, errWithCode := suite.processor.Stream().Open(context.Background(), repliedAccount, stream.TimelineHome) @@ -317,9 +318,9 @@ func (suite *FromFederatorTestSuite) TestProcessAccountDelete() { UpdatedAt: time.Now().Add(-1 * time.Hour), AccountID: deletedAccount.ID, TargetAccountID: receivingAccount.ID, - ShowReblogs: testrig.TrueBool(), + ShowReblogs: util.Ptr(true), URI: fmt.Sprintf("%s/follows/01FGRY72ASHBSET64353DPHK9T", deletedAccount.URI), - Notify: testrig.FalseBool(), + Notify: util.Ptr(false), } err := suite.db.Put(ctx, zorkFollowSatan) suite.NoError(err) @@ -330,9 +331,9 @@ func (suite *FromFederatorTestSuite) TestProcessAccountDelete() { UpdatedAt: time.Now().Add(-1 * time.Hour), AccountID: receivingAccount.ID, TargetAccountID: deletedAccount.ID, - ShowReblogs: testrig.TrueBool(), + ShowReblogs: util.Ptr(true), URI: fmt.Sprintf("%s/follows/01FGRYAVAWWPP926J175QGM0WV", receivingAccount.URI), - Notify: testrig.FalseBool(), + Notify: util.Ptr(false), } err = suite.db.Put(ctx, satanFollowZork) suite.NoError(err) @@ -405,9 +406,9 @@ func (suite *FromFederatorTestSuite) TestProcessFollowRequestLocked() { Account: originAccount, TargetAccountID: targetAccount.ID, TargetAccount: targetAccount, - ShowReblogs: testrig.TrueBool(), + ShowReblogs: util.Ptr(true), URI: fmt.Sprintf("%s/follows/01FGRYAVAWWPP926J175QGM0WV", originAccount.URI), - Notify: testrig.FalseBool(), + Notify: util.Ptr(false), } err := suite.db.Put(ctx, satanFollowRequestTurtle) @@ -462,9 +463,9 @@ func (suite *FromFederatorTestSuite) TestProcessFollowRequestUnlocked() { Account: originAccount, TargetAccountID: targetAccount.ID, TargetAccount: targetAccount, - ShowReblogs: testrig.TrueBool(), + ShowReblogs: util.Ptr(true), URI: fmt.Sprintf("%s/follows/01FGRYAVAWWPP926J175QGM0WV", originAccount.URI), - Notify: testrig.FalseBool(), + Notify: util.Ptr(false), } err := suite.db.Put(ctx, satanFollowRequestTurtle) diff --git a/internal/processing/media/getfile_test.go b/internal/processing/media/getfile_test.go index c1acd859b..f0517b339 100644 --- a/internal/processing/media/getfile_test.go +++ b/internal/processing/media/getfile_test.go @@ -28,6 +28,7 @@ import ( apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/media" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -68,7 +69,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncached() { // uncache the file from local testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"] - testAttachment.Cached = testrig.FalseBool() + testAttachment.Cached = util.Ptr(false) err := suite.db.UpdateByID(ctx, testAttachment, testAttachment.ID, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) @@ -120,7 +121,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileUncachedInterrupted() { // uncache the file from local testAttachment := suite.testAttachments["remote_account_1_status_1_attachment_1"] - testAttachment.Cached = testrig.FalseBool() + testAttachment.Cached = util.Ptr(false) err := suite.db.UpdateByID(ctx, testAttachment, testAttachment.ID, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) @@ -177,7 +178,7 @@ func (suite *GetFileTestSuite) TestGetRemoteFileThumbnailUncached() { suite.NoError(err) // uncache the file from local - testAttachment.Cached = testrig.FalseBool() + testAttachment.Cached = util.Ptr(false) err = suite.db.UpdateByID(ctx, testAttachment, testAttachment.ID, "cached") suite.NoError(err) err = suite.storage.Delete(ctx, testAttachment.File.Path) diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go index 9b2552131..ea77bb65c 100644 --- a/internal/typeutils/astointernal.go +++ b/internal/typeutils/astointernal.go @@ -31,6 +31,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/uris" + "github.com/superseriousbusiness/gotosocial/internal/util" ) func (c *converter) ASRepresentationToAccount(ctx context.Context, accountable ap.Accountable, accountDomain string) (*gtsmodel.Account, error) { @@ -396,11 +397,10 @@ func (c *converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab // TODO: a lot of work to be done here -- a new type // needs to be created for this in go-fed/activity. // Until this is implemented, assume all true. - var trueBool = func() *bool { b := true; return &b } - status.Federated = trueBool() - status.Boostable = trueBool() - status.Replyable = trueBool() - status.Likeable = trueBool() + status.Federated = util.Ptr(true) + status.Boostable = util.Ptr(true) + status.Replyable = util.Ptr(true) + status.Likeable = util.Ptr(true) // status.Sensitive status.Sensitive = func() *bool { diff --git a/internal/util/ptr.go b/internal/util/ptr.go new file mode 100644 index 000000000..4b7450b66 --- /dev/null +++ b/internal/util/ptr.go @@ -0,0 +1,23 @@ +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package util + +// Ptr returns a pointer to the passed in type +func Ptr[T any](t T) *T { + return &t +} diff --git a/internal/visibility/home_timeline_test.go b/internal/visibility/home_timeline_test.go index 3239d70b1..bc64c6425 100644 --- a/internal/visibility/home_timeline_test.go +++ b/internal/visibility/home_timeline_test.go @@ -25,6 +25,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -115,7 +116,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestThread() { Content: "nbnbdy expects dog", CreatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: threadParentAccount.ID, InReplyToID: originalStatus.ID, @@ -124,13 +125,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestThread() { BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, firstReplyStatus); err != nil { @@ -168,7 +169,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( Content: "didn't expect dog", CreatedAt: testrig.TimeMustParse("2021-09-20T12:40:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:40:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", AccountID: originalStatusParent.ID, InReplyToID: "", @@ -177,13 +178,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, originalStatus); err != nil { @@ -202,7 +203,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( Content: "nbnbdy expects dog", CreatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: replyingAccount.ID, InReplyToID: originalStatus.ID, @@ -211,13 +212,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, firstReplyStatus); err != nil { @@ -236,7 +237,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( Content: "*nobody", CreatedAt: testrig.TimeMustParse("2021-09-20T12:42:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:42:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: replyingAccount.ID, InReplyToID: firstReplyStatus.ID, @@ -245,13 +246,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, secondReplyStatus); err != nil { @@ -281,7 +282,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc Content: "didn't expect dog", CreatedAt: testrig.TimeMustParse("2021-09-20T12:40:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:40:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", AccountID: originalStatusParent.ID, InReplyToID: "", @@ -290,13 +291,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityUnlocked, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, originalStatus); err != nil { @@ -315,7 +316,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc Content: "nbnbdy expects dog", CreatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:41:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: replyingAccount.ID, InReplyToID: originalStatus.ID, @@ -324,13 +325,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, firstReplyStatus); err != nil { @@ -349,7 +350,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc Content: "*nobody", CreatedAt: testrig.TimeMustParse("2021-09-20T12:42:37+02:00"), UpdatedAt: testrig.TimeMustParse("2021-09-20T12:42:37+02:00"), - Local: testrig.FalseBool(), + Local: util.Ptr(false), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: replyingAccount.ID, InReplyToID: firstReplyStatus.ID, @@ -358,13 +359,13 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnloc BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityUnlocked, - Sensitive: testrig.FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: testrig.TrueBool(), - Boostable: testrig.TrueBool(), - Replyable: testrig.TrueBool(), - Likeable: testrig.TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, } if err := suite.db.PutStatus(ctx, secondReplyStatus); err != nil { diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 1a5264db3..fd26b514e 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -40,33 +40,9 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/transport" + "github.com/superseriousbusiness/gotosocial/internal/util" ) -// TrueBool just returns a pointer to boolean true. -func TrueBool() *bool { - b := new(bool) - *b = true - return b -} - -// FalseBool just returns a pointer to boolean false. -func FalseBool() *bool { - return new(bool) -} - -// StringPtr returns a pointer to the given string. -func StringPtr(in string) *string { - return &in -} - -func Float32Ptr(in float32) *float32 { - return &in -} - -func Uint64Ptr(in uint64) *uint64 { - return &in -} - // NewTestTokens returns a map of tokens keyed according to which account the token belongs to. func NewTestTokens() map[string]*gtsmodel.Token { tokens := map[string]*gtsmodel.Token{ @@ -206,10 +182,10 @@ func NewTestUsers() map[string]*gtsmodel.User { ConfirmedAt: time.Time{}, ConfirmationSentAt: TimeMustParse("2022-06-04T13:12:00Z"), UnconfirmedEmail: "weed_lord420@example.org", - Moderator: FalseBool(), - Admin: FalseBool(), - Disabled: FalseBool(), - Approved: FalseBool(), + Moderator: util.Ptr(false), + Admin: util.Ptr(false), + Disabled: util.Ptr(false), + Approved: util.Ptr(false), ResetPasswordToken: "", ResetPasswordSentAt: time.Time{}, }, @@ -236,10 +212,10 @@ func NewTestUsers() map[string]*gtsmodel.User { ConfirmedAt: TimeMustParse("2022-06-02T13:12:00Z"), ConfirmationSentAt: time.Time{}, UnconfirmedEmail: "", - Moderator: TrueBool(), - Admin: TrueBool(), - Disabled: FalseBool(), - Approved: TrueBool(), + Moderator: util.Ptr(true), + Admin: util.Ptr(true), + Disabled: util.Ptr(false), + Approved: util.Ptr(true), ResetPasswordToken: "", ResetPasswordSentAt: time.Time{}, }, @@ -266,10 +242,10 @@ func NewTestUsers() map[string]*gtsmodel.User { ConfirmedAt: TimeMustParse("2022-06-02T13:12:00Z"), ConfirmationSentAt: TimeMustParse("2022-06-02T13:12:00Z"), UnconfirmedEmail: "", - Moderator: FalseBool(), - Admin: FalseBool(), - Disabled: FalseBool(), - Approved: TrueBool(), + Moderator: util.Ptr(false), + Admin: util.Ptr(false), + Disabled: util.Ptr(false), + Approved: util.Ptr(true), ResetPasswordToken: "", ResetPasswordSentAt: time.Time{}, }, @@ -296,10 +272,10 @@ func NewTestUsers() map[string]*gtsmodel.User { ConfirmedAt: TimeMustParse("2022-05-24T13:12:00Z"), ConfirmationSentAt: TimeMustParse("2022-05-23T13:12:00Z"), UnconfirmedEmail: "", - Moderator: FalseBool(), - Admin: FalseBool(), - Disabled: FalseBool(), - Approved: TrueBool(), + Moderator: util.Ptr(false), + Admin: util.Ptr(false), + Disabled: util.Ptr(false), + Approved: util.Ptr(true), ResetPasswordToken: "", ResetPasswordSentAt: time.Time{}, }, @@ -320,16 +296,16 @@ func NewTestAccounts() map[string]*gtsmodel.Account { Fields: []*gtsmodel.Field{}, Note: "", NoteRaw: "", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2020-05-17T13:10:59Z"), UpdatedAt: TimeMustParse("2020-05-17T13:10:59Z"), - Bot: FalseBool(), + Bot: util.Ptr(false), Reason: "", - Locked: FalseBool(), - Discoverable: TrueBool(), + Locked: util.Ptr(false), + Discoverable: util.Ptr(true), Privacy: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", URI: "http://localhost:8080/users/localhost:8080", URL: "http://localhost:8080/@localhost:8080", @@ -347,9 +323,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", - EnableRSS: FalseBool(), + EnableRSS: util.Ptr(false), }, "unconfirmed_account": { ID: "01F8MH0BBE4FHXPH513MBVFHB0", @@ -359,16 +335,16 @@ func NewTestAccounts() map[string]*gtsmodel.Account { DisplayName: "", Fields: []*gtsmodel.Field{}, Note: "", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), + Bot: util.Ptr(false), Reason: "hi, please let me in! I'm looking for somewhere neato bombeato to hang out.", - Locked: FalseBool(), - Discoverable: FalseBool(), + Locked: util.Ptr(false), + Discoverable: util.Ptr(false), Privacy: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", URI: "http://localhost:8080/users/weed_lord420", URL: "http://localhost:8080/@weed_lord420", @@ -386,7 +362,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", }, "admin_account": { @@ -398,16 +374,16 @@ func NewTestAccounts() map[string]*gtsmodel.Account { Fields: []*gtsmodel.Field{}, Note: "", NoteRaw: "", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2022-05-17T13:10:59Z"), UpdatedAt: TimeMustParse("2022-05-17T13:10:59Z"), - Bot: FalseBool(), + Bot: util.Ptr(false), Reason: "", - Locked: FalseBool(), - Discoverable: TrueBool(), + Locked: util.Ptr(false), + Discoverable: util.Ptr(true), Privacy: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", URI: "http://localhost:8080/users/admin", URL: "http://localhost:8080/@admin", @@ -425,9 +401,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", - EnableRSS: TrueBool(), + EnableRSS: util.Ptr(true), }, "local_account_1": { ID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -438,16 +414,16 @@ func NewTestAccounts() map[string]*gtsmodel.Account { Fields: []*gtsmodel.Field{}, Note: "

hey yo this is my profile!

", NoteRaw: "hey yo this is my profile!", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2022-05-20T11:09:18Z"), UpdatedAt: TimeMustParse("2022-05-20T11:09:18Z"), - Bot: FalseBool(), + Bot: util.Ptr(false), Reason: "I wanna be on this damned webbed site so bad! Please! Wow", - Locked: FalseBool(), - Discoverable: TrueBool(), + Locked: util.Ptr(false), + Discoverable: util.Ptr(true), Privacy: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", URI: "http://localhost:8080/users/the_mighty_zork", URL: "http://localhost:8080/@the_mighty_zork", @@ -465,9 +441,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", - EnableRSS: TrueBool(), + EnableRSS: util.Ptr(true), }, "local_account_2": { ID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -497,16 +473,16 @@ func NewTestAccounts() map[string]*gtsmodel.Account { }, Note: "

i post about things that concern me

", NoteRaw: "i post about things that concern me", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), + Bot: util.Ptr(false), Reason: "", - Locked: TrueBool(), - Discoverable: FalseBool(), + Locked: util.Ptr(true), + Discoverable: util.Ptr(false), Privacy: gtsmodel.VisibilityFollowersOnly, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "fr", URI: "http://localhost:8080/users/1happyturtle", URL: "http://localhost:8080/@1happyturtle", @@ -524,9 +500,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", - EnableRSS: FalseBool(), + EnableRSS: util.Ptr(false), }, "remote_account_1": { ID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", @@ -535,20 +511,20 @@ func NewTestAccounts() map[string]*gtsmodel.Account { DisplayName: "big gerald", Fields: []*gtsmodel.Field{}, Note: "i post about like, i dunno, stuff, or whatever!!!!", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2021-09-26T12:52:36+02:00"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), - Locked: FalseBool(), - Discoverable: TrueBool(), - Sensitive: FalseBool(), + Bot: util.Ptr(false), + Locked: util.Ptr(false), + Discoverable: util.Ptr(true), + Sensitive: util.Ptr(false), Language: "en", URI: "http://fossbros-anonymous.io/users/foss_satan", URL: "http://fossbros-anonymous.io/@foss_satan", FetchedAt: time.Time{}, InboxURI: "http://fossbros-anonymous.io/users/foss_satan/inbox", - SharedInboxURI: StringPtr("http://fossbros-anonymous.io/inbox"), + SharedInboxURI: util.Ptr("http://fossbros-anonymous.io/inbox"), OutboxURI: "http://fossbros-anonymous.io/users/foss_satan/outbox", FollowersURI: "http://fossbros-anonymous.io/users/foss_satan/followers", FollowingURI: "http://fossbros-anonymous.io/users/foss_satan/following", @@ -561,7 +537,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", }, "remote_account_2": { @@ -571,20 +547,20 @@ func NewTestAccounts() map[string]*gtsmodel.Account { DisplayName: "some user", Fields: []*gtsmodel.Field{}, Note: "i'm a real son of a gun", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), - Locked: TrueBool(), - Discoverable: TrueBool(), - Sensitive: FalseBool(), + Bot: util.Ptr(false), + Locked: util.Ptr(true), + Discoverable: util.Ptr(true), + Sensitive: util.Ptr(false), Language: "en", URI: "http://example.org/users/Some_User", URL: "http://example.org/@Some_User", FetchedAt: time.Time{}, InboxURI: "http://example.org/users/Some_User/inbox", - SharedInboxURI: StringPtr(""), + SharedInboxURI: util.Ptr(""), OutboxURI: "http://example.org/users/Some_User/outbox", FollowersURI: "http://example.org/users/Some_User/followers", FollowingURI: "http://example.org/users/Some_User/following", @@ -597,7 +573,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", }, "remote_account_3": { @@ -607,20 +583,20 @@ func NewTestAccounts() map[string]*gtsmodel.Account { DisplayName: "lizzzieeeeeeeeeeee", Fields: []*gtsmodel.Field{}, Note: "if i die blame charles don't let that fuck become king", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), - Locked: TrueBool(), - Discoverable: TrueBool(), - Sensitive: FalseBool(), + Bot: util.Ptr(false), + Locked: util.Ptr(true), + Discoverable: util.Ptr(true), + Sensitive: util.Ptr(false), Language: "en", URI: "http://thequeenisstillalive.technology/users/her_fuckin_maj", URL: "http://thequeenisstillalive.technology/@her_fuckin_maj", FetchedAt: time.Time{}, InboxURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/inbox", - SharedInboxURI: StringPtr(""), + SharedInboxURI: util.Ptr(""), OutboxURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/outbox", FollowersURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/followers", FollowingURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/following", @@ -633,7 +609,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", HeaderMediaAttachmentID: "01PFPMWK2FF0D9WMHEJHR07C3R", }, @@ -643,20 +619,20 @@ func NewTestAccounts() map[string]*gtsmodel.Account { Domain: "xn--xample-ova.org", DisplayName: "", Note: "", - Memorial: FalseBool(), + Memorial: util.Ptr(false), MovedToAccountID: "", CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"), UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"), - Bot: FalseBool(), - Locked: FalseBool(), - Discoverable: FalseBool(), - Sensitive: FalseBool(), + Bot: util.Ptr(false), + Locked: util.Ptr(false), + Discoverable: util.Ptr(false), + Sensitive: util.Ptr(false), Language: "de", URI: "https://xn--xample-ova.org/users/%C3%BCser", URL: "https://xn--xample-ova.org/users/@%C3%BCser", FetchedAt: time.Time{}, InboxURI: "https://xn--xample-ova.org/users/%C3%BCser/inbox", - SharedInboxURI: StringPtr(""), + SharedInboxURI: util.Ptr(""), OutboxURI: "https://xn--xample-ova.org/users/%C3%BCser/outbox", FollowersURI: "https://xn--xample-ova.org/users/%C3%BCser/followers", FollowingURI: "https://xn--xample-ova.org/users/%C3%BCser/following", @@ -669,10 +645,10 @@ func NewTestAccounts() map[string]*gtsmodel.Account { SensitizedAt: time.Time{}, SilencedAt: time.Time{}, SuspendedAt: time.Time{}, - HideCollections: FalseBool(), + HideCollections: util.Ptr(false), SuspensionOrigin: "", HeaderMediaAttachmentID: "", - EnableRSS: FalseBool(), + EnableRSS: util.Ptr(false), }, } @@ -784,9 +760,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/small/01F8MH6NEM8D7527KZAECTCR76.jpg", RemoteURL: "", }, - Avatar: FalseBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "local_account_1_status_4_attachment_1": { ID: "01F8MH7TDVANYKWVE8VVKFPJTJ", @@ -833,9 +809,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH7TDVANYKWVE8VVKFPJTJ.jpg", RemoteURL: "", }, - Avatar: FalseBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "local_account_1_status_4_attachment_2": { ID: "01CDR64G398ADCHXK08WWTHEZ5", @@ -851,9 +827,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { Height: 404, Size: 290880, Aspect: 1.78217821782178, - Duration: Float32Ptr(15.033334), - Framerate: Float32Ptr(30.0), - Bitrate: Uint64Ptr(1206522), + Duration: util.Ptr[float32](15.033334), + Framerate: util.Ptr[float32](30.0), + Bitrate: util.Ptr[uint64](1206522), }, Small: gtsmodel.Small{ Width: 720, @@ -885,9 +861,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01CDR64G398ADCHXK08WWTHEZ5.jpg", RemoteURL: "", }, - Avatar: FalseBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "local_account_1_unattached_1": { ID: "01F8MH8RMYQ6MSNY3JM2XT1CQ5", @@ -934,9 +910,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpg", RemoteURL: "", }, - Avatar: FalseBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "local_account_1_avatar": { ID: "01F8MH58A357CV5K7R7TJMSH6S", @@ -983,9 +959,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpg", RemoteURL: "", }, - Avatar: TrueBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(true), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "local_account_1_header": { ID: "01PFPMWK2FF0D9WMHEJHR07C3Q", @@ -1032,9 +1008,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg", RemoteURL: "", }, - Avatar: FalseBool(), - Header: TrueBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(true), + Cached: util.Ptr(true), }, "remote_account_1_status_1_attachment_1": { ID: "01FVW7RXPQ8YJHTEXYPE7Q8ZY0", @@ -1081,9 +1057,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/small/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg", RemoteURL: "http://fossbros-anonymous.io/attachments/small/a499f55b-2d1e-4acd-98d2-1ac2ba6d79b9.jpg", }, - Avatar: FalseBool(), - Header: FalseBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(false), + Cached: util.Ptr(true), }, "remote_account_3_header": { ID: "01PFPMWK2FF0D9WMHEJHR07C3R", @@ -1130,9 +1106,9 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment { URL: "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/small/01PFPMWK2FF0D9WMHEJHR07C3R.jpg", RemoteURL: "http://fossbros-anonymous.io/attachments/small/a499f55b-2d1e-4acd-98d2-1ac2ba6d79b9.jpg", }, - Avatar: FalseBool(), - Header: TrueBool(), - Cached: TrueBool(), + Avatar: util.Ptr(false), + Header: util.Ptr(true), + Cached: util.Ptr(true), }, } } @@ -1157,11 +1133,11 @@ func NewTestEmojis() map[string]*gtsmodel.Emoji { ImageFileSize: 36702, ImageStaticFileSize: 10413, ImageUpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), - Disabled: FalseBool(), + Disabled: util.Ptr(false), URI: "http://localhost:8080/emoji/01F8MH9H8E4VG3KDYJR9EGPXCQ", - VisibleInPicker: TrueBool(), + VisibleInPicker: util.Ptr(true), CategoryID: "01GGQ8V4993XK67B2JB396YFB7", - Cached: FalseBool(), + Cached: util.Ptr(false), }, "yell": { ID: "01GD5KP5CQEE1R3X43Y1EHS2CW", @@ -1180,11 +1156,11 @@ func NewTestEmojis() map[string]*gtsmodel.Emoji { ImageFileSize: 10889, ImageStaticFileSize: 10808, ImageUpdatedAt: TimeMustParse("2020-03-18T13:12:00+01:00"), - Disabled: FalseBool(), + Disabled: util.Ptr(false), URI: "http://fossbros-anonymous.io/emoji/01GD5KP5CQEE1R3X43Y1EHS2CW", - VisibleInPicker: FalseBool(), + VisibleInPicker: util.Ptr(false), CategoryID: "", - Cached: FalseBool(), + Cached: util.Ptr(false), }, } } @@ -1257,7 +1233,7 @@ func NewTestDomainBlocks() map[string]*gtsmodel.DomainBlock { CreatedByAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", PrivateComment: "i blocked this domain because they keep replying with pushy + unwarranted linux advice", PublicComment: "reply-guying to tech posts", - Obfuscate: FalseBool(), + Obfuscate: util.Ptr(false), }, } } @@ -1333,20 +1309,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { EmojiIDs: []string{"01F8MH9H8E4VG3KDYJR9EGPXCQ"}, CreatedAt: TimeMustParse("2021-10-20T11:36:45Z"), UpdatedAt: TimeMustParse("2021-10-20T11:36:45Z"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "admin_account_status_2": { @@ -1358,20 +1334,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐕🐕🐕🐕🐕", CreatedAt: TimeMustParse("2021-10-20T12:36:45Z"), UpdatedAt: TimeMustParse("2021-10-20T12:36:45Z"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", ContentWarning: "open to see some puppies", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "admin_account_status_3": { @@ -1382,7 +1358,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "hi @the_mighty_zork welcome to the instance!", CreatedAt: TimeMustParse("2021-11-20T13:32:16Z"), UpdatedAt: TimeMustParse("2021-11-20T13:32:16Z"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", MentionIDs: []string{"01FF26A6BGEKCZFWNEHXB2ZZ6M"}, AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", @@ -1391,13 +1367,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status { InReplyToURI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY", BoostOfID: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "admin_account_status_4": { @@ -1408,7 +1384,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "hello everyone!", CreatedAt: TimeMustParse("2021-10-20T12:41:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:41:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", @@ -1418,13 +1394,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status { BoostOfAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_1_status_1": { @@ -1435,20 +1411,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "hello everyone!", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_1_status_2": { @@ -1459,20 +1435,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "this is an unlocked local-only post that shouldn't federate, but it's still boostable, replyable, and likeable", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityUnlocked, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG", - Federated: FalseBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(false), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_1_status_3": { @@ -1483,20 +1459,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "this is a very personal post that I don't want anyone to interact with at all, and i only want mutuals to see it", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", ContentWarning: "test: you shouldn't be able to interact with this post in any way", Visibility: gtsmodel.VisibilityMutualsOnly, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG", - Federated: TrueBool(), - Boostable: FalseBool(), - Replyable: FalseBool(), - Likeable: FalseBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(false), + Replyable: util.Ptr(false), + Likeable: util.Ptr(false), ActivityStreamsType: ap.ObjectNote, }, "local_account_1_status_4": { @@ -1508,20 +1484,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AttachmentIDs: []string{"01F8MH7TDVANYKWVE8VVKFPJTJ", "01CDR64G398ADCHXK08WWTHEZ5"}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", ContentWarning: "eye contact, trent reznor gif, cow", Visibility: gtsmodel.VisibilityMutualsOnly, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_1_status_5": { @@ -1533,20 +1509,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2022-05-20T11:37:55Z"), UpdatedAt: TimeMustParse("2022-05-20T11:37:55Z"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_1": { @@ -1557,20 +1533,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 hi everyone i post about turtles 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_2": { @@ -1581,20 +1557,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 this one is federated, likeable, and boostable but not replyable 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: FalseBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(false), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_3": { @@ -1605,20 +1581,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 i don't mind people sharing this one but I don't want likes or replies to it because cba🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", ContentWarning: "you won't be able to like or reply to this", Visibility: gtsmodel.VisibilityUnlocked, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: FalseBool(), - Likeable: FalseBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(false), + Likeable: util.Ptr(false), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_4": { @@ -1629,20 +1605,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 this is a public status but I want it local only and not boostable 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: TrueBool(), + Sensitive: util.Ptr(true), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: FalseBool(), - Boostable: FalseBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(false), + Boostable: util.Ptr(false), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, @@ -1654,7 +1630,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 @the_mighty_zork hi zork! 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", MentionIDs: []string{"01FDF2HM2NF6FSRZCDEDV451CN"}, AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1664,13 +1640,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status { BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_6": { @@ -1681,7 +1657,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", MentionIDs: []string{"01FDF2HM2NF6FSRZCDEDV451CN"}, AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1691,13 +1667,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status { BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityDirect, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "local_account_2_status_7": { @@ -1710,20 +1686,20 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - Local: TrueBool(), + Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, "remote_account_1_status_1": { @@ -1734,7 +1710,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AttachmentIDs: []string{"01FVW7RXPQ8YJHTEXYPE7Q8ZY0"}, CreatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), - Local: FalseBool(), + Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", MentionIDs: []string{}, AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", @@ -1744,13 +1720,13 @@ func NewTestStatuses() map[string]*gtsmodel.Status { BoostOfID: "", ContentWarning: "", Visibility: gtsmodel.VisibilityUnlocked, - Sensitive: FalseBool(), + Sensitive: util.Ptr(false), Language: "en", CreatedWithApplicationID: "", - Federated: TrueBool(), - Boostable: TrueBool(), - Replyable: TrueBool(), - Likeable: TrueBool(), + Federated: util.Ptr(true), + Boostable: util.Ptr(true), + Replyable: util.Ptr(true), + Likeable: util.Ptr(true), ActivityStreamsType: ap.ObjectNote, }, } @@ -1764,16 +1740,16 @@ func NewTestTags() map[string]*gtsmodel.Tag { Name: "welcome", CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"), UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"), - Useable: TrueBool(), - Listable: TrueBool(), + Useable: util.Ptr(true), + Listable: util.Ptr(true), }, "Hashtag": { ID: "01FCT9SGYA71487N8D0S1M638G", Name: "hashtag", CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"), UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"), - Useable: TrueBool(), - Listable: TrueBool(), + Useable: util.Ptr(true), + Listable: util.Ptr(true), }, } } @@ -1909,7 +1885,7 @@ func NewTestNotifications() map[string]*gtsmodel.Notification { TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", OriginAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", StatusID: "01F8MHAMCHF6Y650WCRSCP4WMY", - Read: FalseBool(), + Read: util.Ptr(false), }, "local_account_2_like": { ID: "01GTS6PRPXJYZBPFFQ56PP0XR8", @@ -1918,7 +1894,7 @@ func NewTestNotifications() map[string]*gtsmodel.Notification { TargetAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", OriginAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", StatusID: "01F8MH75CBF9JFX4ZAD54N0W0R", - Read: FalseBool(), + Read: util.Ptr(false), }, } } @@ -1932,9 +1908,9 @@ func NewTestFollows() map[string]*gtsmodel.Follow { UpdatedAt: TimeMustParse("2022-05-14T16:21:09+02:00"), AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", TargetAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", - ShowReblogs: TrueBool(), + ShowReblogs: util.Ptr(true), URI: "http://localhost:8080/users/the_mighty_zork/follow/01F8PY8RHWRQZV038T4E8T9YK8", - Notify: FalseBool(), + Notify: util.Ptr(false), }, "local_account_1_local_account_2": { ID: "01F8PYDCE8XE23GRE5DPZJDZDP", @@ -1942,9 +1918,9 @@ func NewTestFollows() map[string]*gtsmodel.Follow { UpdatedAt: TimeMustParse("2022-05-14T15:21:09+02:00"), AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", - ShowReblogs: TrueBool(), + ShowReblogs: util.Ptr(true), URI: "http://localhost:8080/users/the_mighty_zork/follow/01F8PYDCE8XE23GRE5DPZJDZDP", - Notify: FalseBool(), + Notify: util.Ptr(false), }, "local_account_2_local_account_1": { ID: "01G1TK1RS4K3E0MSFTXBFWAH9Q", @@ -1952,9 +1928,9 @@ func NewTestFollows() map[string]*gtsmodel.Follow { UpdatedAt: TimeMustParse("2022-05-14T14:21:09+02:00"), AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", - ShowReblogs: TrueBool(), + ShowReblogs: util.Ptr(true), URI: "http://localhost:8080/users/1happyturtle/follow/01F8PYDCE8XE23GRE5DPZJDZDP", - Notify: FalseBool(), + Notify: util.Ptr(false), }, "admin_account_local_account_1": { ID: "01G1TK3PQKFW1BQZ9WVYRTFECK", @@ -1962,9 +1938,9 @@ func NewTestFollows() map[string]*gtsmodel.Follow { UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"), AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", - ShowReblogs: TrueBool(), + ShowReblogs: util.Ptr(true), URI: "http://localhost:8080/users/admin/follow/01G1TK3PQKFW1BQZ9WVYRTFECK", - Notify: FalseBool(), + Notify: util.Ptr(false), }, } } @@ -2044,7 +2020,7 @@ func NewTestReports() map[string]*gtsmodel.Report { TargetAccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", Comment: "dark souls sucks, please yeet this nerd", StatusIDs: []string{"01FVW7JHQFSFK166WWKR8CBA6M"}, - Forwarded: TrueBool(), + Forwarded: util.Ptr(true), }, "remote_account_1_report_local_account_2": { ID: "01GP3DFY9XQ1TJMZT5BGAZPXX7", @@ -2055,7 +2031,7 @@ func NewTestReports() map[string]*gtsmodel.Report { TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", Comment: "this is a turtle, not a person, therefore should not be a poster", StatusIDs: []string{}, - Forwarded: TrueBool(), + Forwarded: util.Ptr(true), ActionTaken: "user was warned not to be a turtle anymore", ActionTakenAt: TimeMustParse("2022-05-15T17:01:56+02:00"), ActionTakenByAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",