From 8ae2440da3a9b66c379c5a9444b50e758deef61b Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:39:40 +0200 Subject: [chore] Migrate accounts to new table, relax uniqueness constraint of actor `url` and collections (#3928) * [chore] Migrate accounts to new table, relax uniqueness constraint of actor url and collections * fiddle with it! (that's what she said) * remove unused cache fields * sillyness * fix tiny whoopsie --- internal/typeutils/astointernal.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'internal/typeutils/astointernal.go') diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go index 741e1509e..80e1de378 100644 --- a/internal/typeutils/astointernal.go +++ b/internal/typeutils/astointernal.go @@ -70,19 +70,10 @@ func (c *Converter) ASRepresentationToAccount( acct.URI = uri // Check whether account is a usable actor type. - switch acct.ActorType = accountable.GetTypeName(); acct.ActorType { - - // people, groups, and organizations aren't bots - case ap.ActorPerson, ap.ActorGroup, ap.ActorOrganization: - acct.Bot = util.Ptr(false) - - // apps and services are - case ap.ActorApplication, ap.ActorService: - acct.Bot = util.Ptr(true) - - // we don't know what this is! - default: - err := gtserror.Newf("unusable actor type for %s", uri) + actorTypeName := accountable.GetTypeName() + acct.ActorType = gtsmodel.ParseAccountActorType(actorTypeName) + if acct.ActorType == gtsmodel.AccountActorTypeUnknown { + err := gtserror.Newf("unusable actor type %s for %s", actorTypeName, uri) return nil, gtserror.SetMalformed(err) } @@ -161,7 +152,7 @@ func (c *Converter) ASRepresentationToAccount( acct.Note = ap.ExtractSummary(accountable) // Assume not memorial (todo) - acct.Memorial = util.Ptr(false) + acct.MemorializedAt = time.Time{} // Extract 'manuallyApprovesFollowers' aka locked account (default = true). manuallyApprovesFollowers := ap.GetManuallyApprovesFollowers(accountable) -- cgit v1.2.3