From aa396c78d30c129bb2145765d3990571dbc025bb Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:45:46 +0100 Subject: [feature] serdes for moved/also_known_as (#2600) * [feature] serdes for moved/also_known_as * document `alsoKnownAs` and `movedTo` properties * only implicitly populate AKA uris from DB for local accounts * don't let remotes store more than 20 AKA uris to avoid shenanigans --- testrig/testmodels.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'testrig') diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 2f7e53666..b350cafe5 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -2799,6 +2799,8 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson { nil, URLMustParse("https://unknown-instance.com/users/brand_new_person/outbox"), URLMustParse("https://unknown-instance.com/users/brand_new_person/collections/featured"), + nil, + nil, "brand_new_person", "Geoff Brando New Personson", "hey I'm a new person, your instance hasn't seen me yet uwu", @@ -2820,6 +2822,8 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson { URLMustParse("https://turnip.farm/sharedInbox"), URLMustParse("https://turnip.farm/users/turniplover6969/outbox"), URLMustParse("https://turnip.farm/users/turniplover6969/collections/featured"), + nil, + nil, "turniplover6969", "Turnip Lover 6969", "I just think they're neat", @@ -2841,6 +2845,8 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson { URLMustParse("http://example.org/sharedInbox"), URLMustParse("http://example.org/users/Some_User/outbox"), URLMustParse("http://example.org/users/Some_User/collections/featured"), + nil, + nil, "Some_User", "just some user, don't mind me", "Peepee poo poo", @@ -3335,6 +3341,8 @@ func newAPPerson( sharedInboxIRI *url.URL, outboxURI *url.URL, featuredURI *url.URL, + movedToURI *url.URL, + alsoKnownAsURIs []*url.URL, username string, displayName string, note string, @@ -3444,9 +3452,15 @@ func newAPPerson( // devices // NOT IMPLEMENTED, probably won't implement - // alsoKnownAs + // alsoKnownAs, movedTo // Required for Move activity. - // 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 + if len(alsoKnownAsURIs) != 0 { + ap.SetAlsoKnownAs(person, alsoKnownAsURIs) + } + + if movedToURI != nil { + ap.SetMovedTo(person, movedToURI) + } // publicKey // Required for signatures. @@ -3628,7 +3642,7 @@ func newAPGroup( // devices // NOT IMPLEMENTED, probably won't implement - // alsoKnownAs + // AlsoKnownAsURI // Required for Move activity. // 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 @@ -3812,7 +3826,7 @@ func newAPService( // devices // NOT IMPLEMENTED, probably won't implement - // alsoKnownAs + // AlsoKnownAsURI // Required for Move activity. // 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 -- cgit v1.2.3