diff options
author | 2022-08-15 12:35:05 +0200 | |
---|---|---|
committer | 2022-08-15 11:35:05 +0100 | |
commit | ac6ed3d939fe9dad81aadbd04541e905c625ca82 (patch) | |
tree | 6116baf25675837dc99f69c49b9fec2ff112ce5c /internal/typeutils/astointernal.go | |
parent | [frontend] Sensitive media spoilers (#752) (diff) | |
download | gotosocial-ac6ed3d939fe9dad81aadbd04541e905c625ca82.tar.xz |
[chore] Update bun / sqlite versions; update gtsmodels (#754)
* upstep bun and sqlite versions
* allow specific columns to be updated in the db
* only update necessary columns for user
* bit tidier
* only update necessary fields of media_attachment
* only update relevant instance fields
* update tests
* update only specific account columns
* use bool pointers on gtsmodels
includes attachment, status, account, user
* update columns more selectively
* test all default fields on new account insert
* updating remaining bools on gtsmodels
* initialize pointer fields when extracting AP emoji
* copy bools properly
* add copyBoolPtr convenience function + test it
* initialize false bool ptrs a bit more neatly
Diffstat (limited to 'internal/typeutils/astointernal.go')
-rw-r--r-- | internal/typeutils/astointernal.go | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go index e30608150..7ec45335d 100644 --- a/internal/typeutils/astointernal.go +++ b/internal/typeutils/astointernal.go @@ -99,29 +99,46 @@ func (c *converter) ASRepresentationToAccount(ctx context.Context, accountable a switch accountable.GetTypeName() { case ap.ActorPerson, ap.ActorGroup, ap.ActorOrganization: // people, groups, and organizations aren't bots - acct.Bot = false + bot := false + acct.Bot = &bot // apps and services are case ap.ActorApplication, ap.ActorService: - acct.Bot = true + bot := true + acct.Bot = &bot default: // we don't know what this is! return nil, fmt.Errorf("type name %s not recognised or not convertible to ap.ActivityStreamsActor", accountable.GetTypeName()) } acct.ActorType = accountable.GetTypeName() + // assume not memorial (todo) + memorial := false + acct.Memorial = &memorial + + // assume not sensitive (todo) + sensitive := false + acct.Sensitive = &sensitive + + // assume not hide collections (todo) + hideCollections := false + acct.HideCollections = &hideCollections + // locked aka manuallyApprovesFollowers - acct.Locked = true // assume locked by default + locked := true + acct.Locked = &locked // assume locked by default maf := accountable.GetActivityStreamsManuallyApprovesFollowers() if maf != nil && maf.IsXMLSchemaBoolean() { - acct.Locked = maf.Get() + locked = maf.Get() + acct.Locked = &locked } // discoverable // default to false -- take custom value if it's set though - acct.Discoverable = false - discoverable, err := ap.ExtractDiscoverable(accountable) + discoverable := false + acct.Discoverable = &discoverable + d, err := ap.ExtractDiscoverable(accountable) if err == nil { - acct.Discoverable = discoverable + acct.Discoverable = &d } // url property @@ -289,13 +306,20 @@ func (c *converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab // advanced visibility for this status // TODO: a lot of work to be done here -- a new type needs to be created for this in go-fed/activity using ASTOOL // for now we just set everything to true - status.Federated = true - status.Boostable = true - status.Replyable = true - status.Likeable = true - + pinned := false + federated := true + boostable := true + replyable := true + likeable := true + + status.Pinned = &pinned + status.Federated = &federated + status.Boostable = &boostable + status.Replyable = &replyable + status.Likeable = &likeable // sensitive - status.Sensitive = ap.ExtractSensitive(statusable) + sensitive := ap.ExtractSensitive(statusable) + status.Sensitive = &sensitive // language // we might be able to extract this from the contentMap field |