mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-09 22:08:08 -06:00
Manually approves followers (#146)
* update go-fed * update go-fed * manuallyapprovesfollowers * serialize manuallyApprovesFollowers
This commit is contained in:
parent
4920229a3b
commit
071eca20ce
44 changed files with 931 additions and 308 deletions
|
|
@ -105,7 +105,12 @@ func (c *converter) ASRepresentationToAccount(accountable ap.Accountable, update
|
|||
}
|
||||
acct.ActorType = accountable.GetTypeName()
|
||||
|
||||
// TODO: locked aka manuallyApprovesFollowers
|
||||
// locked aka manuallyApprovesFollowers
|
||||
acct.Locked = true // assume locked by default
|
||||
maf := accountable.GetActivityStreamsManuallyApprovesFollowers()
|
||||
if maf != nil && maf.IsXMLSchemaBoolean() {
|
||||
acct.Locked = maf.Get()
|
||||
}
|
||||
|
||||
// discoverable
|
||||
// default to false -- take custom value if it's set though
|
||||
|
|
|
|||
|
|
@ -346,14 +346,26 @@ func (suite *ASToInternalTestSuite) SetupTest() {
|
|||
}
|
||||
|
||||
func (suite *ASToInternalTestSuite) TestParsePerson() {
|
||||
|
||||
testPerson := suite.people["new_person_1"]
|
||||
|
||||
acct, err := suite.typeconverter.ASRepresentationToAccount(testPerson, false)
|
||||
assert.NoError(suite.T(), err)
|
||||
|
||||
fmt.Printf("%+v", acct)
|
||||
// TODO: write assertions here, rn we're just eyeballing the output
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person", acct.URI)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person/following", acct.FollowingURI)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person/followers", acct.FollowersURI)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person/inbox", acct.InboxURI)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person/outbox", acct.OutboxURI)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person/collections/featured", acct.FeaturedCollectionURI)
|
||||
suite.Equal("brand_new_person", acct.Username)
|
||||
suite.Equal("Geoff Brando New Personson", acct.DisplayName)
|
||||
suite.Equal("hey I'm a new person, your instance hasn't seen me yet uwu", acct.Note)
|
||||
suite.Equal("https://unknown-instance.com/@brand_new_person", acct.URL)
|
||||
suite.True(acct.Discoverable)
|
||||
suite.Equal("https://unknown-instance.com/users/brand_new_person#main-key", acct.PublicKeyURI)
|
||||
suite.Equal("https://unknown-instance.com/media/some_avatar_filename.jpeg", acct.AvatarRemoteURL)
|
||||
suite.Equal("https://unknown-instance.com/media/some_header_filename.jpeg", acct.HeaderRemoteURL)
|
||||
suite.False(acct.Locked)
|
||||
}
|
||||
|
||||
func (suite *ASToInternalTestSuite) TestParseGargron() {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,9 @@ func (c *converter) AccountToAS(a *gtsmodel.Account) (vocab.ActivityStreamsPerso
|
|||
|
||||
// manuallyApprovesFollowers
|
||||
// Will be shown as a locked account.
|
||||
// TODO: NOT IMPLEMENTED **YET** -- this needs to be added as an activitypub extension to https://github.com/go-fed/activity, see https://github.com/go-fed/activity/tree/master/astool
|
||||
manuallyApprovesFollowersProp := streams.NewActivityStreamsManuallyApprovesFollowersProperty()
|
||||
manuallyApprovesFollowersProp.Set(a.Locked)
|
||||
person.SetActivityStreamsManuallyApprovesFollowers(manuallyApprovesFollowersProp)
|
||||
|
||||
// discoverable
|
||||
// Will be shown in the profile directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue