mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] Use generic pointer function (#2080)
This replaces the different $TypePtr functions with a generic implementation.
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user