diff options
| author | 2023-04-08 12:56:55 +0200 | |
|---|---|---|
| committer | 2023-04-08 12:56:55 +0200 | |
| commit | f28ed21343270bd91f1b5044e9013db3e1a6c64b (patch) | |
| tree | c33f8bde03d253ecad9075d03026deecaaae1728 /internal | |
| parent | [bugfix] warn on maxprocs error instead of failing (#1678) (diff) | |
| download | gotosocial-f28ed21343270bd91f1b5044e9013db3e1a6c64b.tar.xz | |
[bugfix] Fix single author threads not appearing in home timeline (#1679)v0.8.0
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/visibility/home_timeline.go | 4 | ||||
| -rw-r--r-- | internal/visibility/home_timeline_test.go | 48 | 
2 files changed, 50 insertions, 2 deletions
diff --git a/internal/visibility/home_timeline.go b/internal/visibility/home_timeline.go index 1f61df916..e3af03d83 100644 --- a/internal/visibility/home_timeline.go +++ b/internal/visibility/home_timeline.go @@ -98,7 +98,7 @@ func (f *Filter) isStatusHomeTimelineable(ctx context.Context, owner *gtsmodel.A  	var (  		next      *gtsmodel.Status -		oneAuthor bool +		oneAuthor = true // Assume one author until proven otherwise.  		included  bool  		converstn bool  	) @@ -149,7 +149,7 @@ func (f *Filter) isStatusHomeTimelineable(ctx context.Context, owner *gtsmodel.A  		}  		if oneAuthor { -			// Check if this is a single-author status thread. +			// Check if this continues to be a single-author thread.  			oneAuthor = (next.AccountID == status.AccountID)  		}  	} diff --git a/internal/visibility/home_timeline_test.go b/internal/visibility/home_timeline_test.go index b81f8fe4c..3239d70b1 100644 --- a/internal/visibility/home_timeline_test.go +++ b/internal/visibility/home_timeline_test.go @@ -95,6 +95,54 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestStatusNotTooNewTimelinea  	suite.True(timelineable)  } +func (suite *StatusStatusHomeTimelineableTestSuite) TestThread() { +	ctx := context.Background() + +	threadParentAccount := suite.testAccounts["local_account_1"] +	timelineOwnerAccount := suite.testAccounts["local_account_2"] +	originalStatus := suite.testStatuses["local_account_1_status_1"] + +	// this status should be hometimelineable for local_account_2 +	originalStatusTimelineable, err := suite.filter.StatusHomeTimelineable(ctx, timelineOwnerAccount, originalStatus) +	suite.NoError(err) +	suite.True(originalStatusTimelineable) + +	// now a reply from the original status author to their own status +	firstReplyStatus := >smodel.Status{ +		ID:                       "01G395ESAYPK9161QSQEZKATJN", +		URI:                      "http://localhost:8080/users/the_mighty_zork/statuses/01G395ESAYPK9161QSQEZKATJN", +		URL:                      "http://localhost:8080/@the_mighty_zork/statuses/01G395ESAYPK9161QSQEZKATJN", +		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(), +		AccountURI:               "http://localhost:8080/users/the_mighty_zork", +		AccountID:                threadParentAccount.ID, +		InReplyToID:              originalStatus.ID, +		InReplyToAccountID:       threadParentAccount.ID, +		InReplyToURI:             originalStatus.URI, +		BoostOfID:                "", +		ContentWarning:           "", +		Visibility:               gtsmodel.VisibilityFollowersOnly, +		Sensitive:                testrig.FalseBool(), +		Language:                 "en", +		CreatedWithApplicationID: "", +		Federated:                testrig.TrueBool(), +		Boostable:                testrig.TrueBool(), +		Replyable:                testrig.TrueBool(), +		Likeable:                 testrig.TrueBool(), +		ActivityStreamsType:      ap.ObjectNote, +	} +	if err := suite.db.PutStatus(ctx, firstReplyStatus); err != nil { +		suite.FailNow(err.Error()) +	} + +	// this status should also be hometimelineable for local_account_2 +	firstReplyStatusTimelineable, err := suite.filter.StatusHomeTimelineable(ctx, timelineOwnerAccount, firstReplyStatus) +	suite.NoError(err) +	suite.True(firstReplyStatusTimelineable) +} +  func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly() {  	ctx := context.Background()  | 
