[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>
This commit is contained in:
kim 2024-09-28 20:47:46 +00:00 committed by GitHub
commit 095663f5cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 239 additions and 136 deletions

View file

@ -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() {