summaryrefslogtreecommitdiff
path: root/internal/visibility
diff options
context:
space:
mode:
authorLibravatar Daenney <daenney@users.noreply.github.com>2023-08-07 19:38:11 +0200
committerLibravatar GitHub <noreply@github.com>2023-08-07 18:38:11 +0100
commitbe3718f6e4c7bb229f9eb78b44c52d14399977cc (patch)
treea0efc132fbfb806227cc4b9af8bac9f5a5775c1c /internal/visibility
parent[chore]: Bump github.com/tdewolff/minify/v2 from 2.12.7 to 2.12.8 (#2073) (diff)
downloadgotosocial-be3718f6e4c7bb229f9eb78b44c52d14399977cc.tar.xz
[chore] Use generic pointer function (#2080)
This replaces the different $TypePtr functions with a generic implementation.
Diffstat (limited to 'internal/visibility')
-rw-r--r--internal/visibility/home_timeline_test.go85
1 files changed, 43 insertions, 42 deletions
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 {