diff options
author | 2024-09-28 20:47:46 +0000 | |
---|---|---|
committer | 2024-09-28 22:47:46 +0200 | |
commit | 095663f5ccd10a4cd04ef6ad836f37346fc748ae (patch) | |
tree | 2a0c5a6f2d958fcf88501776013485b987766701 /internal/filter | |
parent | [chore] use string formatting package agnostic way of printing request attemp... (diff) | |
download | gotosocial-095663f5ccd10a4cd04ef6ad836f37346fc748ae.tar.xz |
[bugfix] visibility after implicit approval not getting invalidated (#3370)
* replicate issue
* update go-structr to v0.8.10 with internal linked-list fix, small tweaks to caching of interaction requests
* remove debug function
---------
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/filter')
-rw-r--r-- | internal/filter/visibility/status_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/filter/visibility/status_test.go b/internal/filter/visibility/status_test.go index 9b210e500..795441e7f 100644 --- a/internal/filter/visibility/status_test.go +++ b/internal/filter/visibility/status_test.go @@ -168,6 +168,9 @@ func (suite *StatusVisibleTestSuite) TestVisiblePending() { testStatus := new(gtsmodel.Status) *testStatus = *suite.testStatuses["admin_account_status_3"] testStatus.PendingApproval = util.Ptr(true) + if err := suite.state.DB.UpdateStatus(ctx, testStatus); err != nil { + suite.FailNow(err.Error()) + } for _, testCase := range []struct { acct *gtsmodel.Account @@ -198,6 +201,43 @@ func (suite *StatusVisibleTestSuite) TestVisiblePending() { suite.NoError(err) suite.Equal(testCase.visible, visible) } + + // Update the status to mark it as approved. + testStatus.PendingApproval = util.Ptr(false) + testStatus.ApprovedByURI = "http://localhost:8080/some/accept/uri" + if err := suite.state.DB.UpdateStatus(ctx, testStatus); err != nil { + suite.FailNow(err.Error()) + } + + for _, testCase := range []struct { + acct *gtsmodel.Account + visible bool + }{ + { + acct: suite.testAccounts["admin_account"], + visible: true, // Own status, always visible. + }, + { + acct: suite.testAccounts["local_account_1"], + visible: true, // Reply to zork, always visible. + }, + { + acct: suite.testAccounts["local_account_2"], + visible: true, // Should be visible now. + }, + { + acct: suite.testAccounts["remote_account_1"], + visible: true, // Should be visible now. + }, + { + acct: nil, // Unauthed request. + visible: true, // Should be visible now (public status). + }, + } { + visible, err := suite.filter.StatusVisible(ctx, testCase.acct, testStatus) + suite.NoError(err) + suite.Equal(testCase.visible, visible) + } } func (suite *StatusVisibleTestSuite) TestVisibleLocalOnly() { |