[bugfix] Don't assume "manuallyApprovesFollowers": true if not set (#3978)

* [bugfix] Don't assume `"manuallyApprovesFollowers": true` if not set

* whoops, tests
This commit is contained in:
tobi
2025-04-07 13:52:24 +02:00
committed by GitHub
parent bce643286c
commit 6f24205a26
3 changed files with 9 additions and 9 deletions

View File

@@ -520,11 +520,11 @@ func SetDiscoverable(with WithDiscoverable, discoverable bool) {
// GetManuallyApprovesFollowers returns the boolean contained in the ManuallyApprovesFollowers property of 'with'. // GetManuallyApprovesFollowers returns the boolean contained in the ManuallyApprovesFollowers property of 'with'.
// //
// Returns default 'true' if property unusable or not set. // Returns default 'false' if property unusable or not set.
func GetManuallyApprovesFollowers(with WithManuallyApprovesFollowers) bool { func GetManuallyApprovesFollowers(with WithManuallyApprovesFollowers) bool {
mafProp := with.GetActivityStreamsManuallyApprovesFollowers() mafProp := with.GetActivityStreamsManuallyApprovesFollowers()
if mafProp == nil || !mafProp.IsXMLSchemaBoolean() { if mafProp == nil || !mafProp.IsXMLSchemaBoolean() {
return true return false
} }
return mafProp.Get() return mafProp.Get()
} }

View File

@@ -154,7 +154,7 @@ func (c *Converter) ASRepresentationToAccount(
// Assume not memorial (todo) // Assume not memorial (todo)
acct.MemorializedAt = time.Time{} acct.MemorializedAt = time.Time{}
// Extract 'manuallyApprovesFollowers' aka locked account (default = true). // Extract 'manuallyApprovesFollowers' aka locked account (default = false).
manuallyApprovesFollowers := ap.GetManuallyApprovesFollowers(accountable) manuallyApprovesFollowers := ap.GetManuallyApprovesFollowers(accountable)
acct.Locked = &manuallyApprovesFollowers acct.Locked = &manuallyApprovesFollowers

View File

@@ -613,7 +613,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", acct.URL) suite.Equal("https://honk.example.org/u/honk_user", acct.URL)
suite.Equal("honk_user", acct.Username) suite.Equal("honk_user", acct.Username)
suite.Equal("honk.example.org", acct.Domain) suite.Equal("honk.example.org", acct.Domain)
suite.True(*acct.Locked) suite.False(*acct.Locked)
suite.False(*acct.Discoverable) suite.False(*acct.Discoverable)
// Store the account representation. // Store the account representation.
@@ -632,7 +632,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", acct.URL) suite.Equal("https://honk.example.org/u/honk_user", acct.URL)
suite.Equal("honk_user", acct.Username) suite.Equal("honk_user", acct.Username)
suite.Equal("honk.example.org", acct.Domain) suite.Equal("honk.example.org", acct.Domain)
suite.True(*acct.Locked) suite.False(*acct.Locked)
suite.False(*acct.Discoverable) suite.False(*acct.Discoverable)
// Check DB version. // Check DB version.
@@ -649,7 +649,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL) suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL)
suite.Equal("honk_user", dbAcct.Username) suite.Equal("honk_user", dbAcct.Username)
suite.Equal("honk.example.org", dbAcct.Domain) suite.Equal("honk.example.org", dbAcct.Domain)
suite.True(*dbAcct.Locked) suite.False(*dbAcct.Locked)
suite.False(*dbAcct.Discoverable) suite.False(*dbAcct.Discoverable)
// Update the account. // Update the account.
@@ -666,7 +666,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", acct.URL) suite.Equal("https://honk.example.org/u/honk_user", acct.URL)
suite.Equal("honk_user", acct.Username) suite.Equal("honk_user", acct.Username)
suite.Equal("honk.example.org", acct.Domain) suite.Equal("honk.example.org", acct.Domain)
suite.True(*acct.Locked) suite.False(*acct.Locked)
suite.False(*acct.Discoverable) suite.False(*acct.Discoverable)
// Check DB version. // Check DB version.
@@ -683,7 +683,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL) suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL)
suite.Equal("honk_user", dbAcct.Username) suite.Equal("honk_user", dbAcct.Username)
suite.Equal("honk.example.org", dbAcct.Domain) suite.Equal("honk.example.org", dbAcct.Domain)
suite.True(*dbAcct.Locked) suite.False(*dbAcct.Locked)
suite.False(*dbAcct.Discoverable) suite.False(*dbAcct.Discoverable)
// Clear caches. // Clear caches.
@@ -703,7 +703,7 @@ func (suite *ASToInternalTestSuite) TestParseHonkAccount() {
suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL) suite.Equal("https://honk.example.org/u/honk_user", dbAcct.URL)
suite.Equal("honk_user", dbAcct.Username) suite.Equal("honk_user", dbAcct.Username)
suite.Equal("honk.example.org", dbAcct.Domain) suite.Equal("honk.example.org", dbAcct.Domain)
suite.True(*dbAcct.Locked) suite.False(*dbAcct.Locked)
suite.False(*dbAcct.Discoverable) suite.False(*dbAcct.Discoverable)
} }