summaryrefslogtreecommitdiff
path: root/internal/typeutils/astointernal.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-06 14:39:40 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-06 14:39:40 +0200
commit8ae2440da3a9b66c379c5a9444b50e758deef61b (patch)
tree06b3ba58208434f6ddbd198a396159ac2c4d9c80 /internal/typeutils/astointernal.go
parent[feature] Allow deleting avatar + header via settings panel (#3970) (diff)
downloadgotosocial-8ae2440da3a9b66c379c5a9444b50e758deef61b.tar.xz
[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
Diffstat (limited to 'internal/typeutils/astointernal.go')
-rw-r--r--internal/typeutils/astointernal.go19
1 files changed, 5 insertions, 14 deletions
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)