From ac6ed3d939fe9dad81aadbd04541e905c625ca82 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 15 Aug 2022 12:35:05 +0200 Subject: [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 --- internal/gtsmodel/account.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'internal/gtsmodel/account.go') diff --git a/internal/gtsmodel/account.go b/internal/gtsmodel/account.go index 9dcb7bd5b..49db7dbda 100644 --- a/internal/gtsmodel/account.go +++ b/internal/gtsmodel/account.go @@ -44,15 +44,15 @@ type Account struct { Fields []Field `validate:"-"` // a key/value map of fields that this account has added to their profile Note string `validate:"-" bun:""` // A note that this account has on their profile (ie., the account's bio/description of themselves) NoteRaw string `validate:"-" bun:""` // The raw contents of .Note without conversion to HTML, only available when requester = target - Memorial bool `validate:"-" bun:",default:false"` // Is this a memorial account, ie., has the user passed away? + Memorial *bool `validate:"-" bun:",default:false"` // Is this a memorial account, ie., has the user passed away? AlsoKnownAs string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account is associated with x account id (TODO: migrate to be AlsoKnownAsID) MovedToAccountID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account has moved this account id in the database - Bot bool `validate:"-" bun:",default:false"` // Does this account identify itself as a bot? + Bot *bool `validate:"-" bun:",default:false"` // Does this account identify itself as a bot? Reason string `validate:"-" bun:""` // What reason was given for signing up when this account was created? - Locked bool `validate:"-" bun:",default:true"` // Does this account need an approval for new followers? - Discoverable bool `validate:"-" bun:",default:false"` // Should this account be shown in the instance's profile directory? + Locked *bool `validate:"-" bun:",default:true"` // Does this account need an approval for new followers? + Discoverable *bool `validate:"-" bun:",default:false"` // Should this account be shown in the instance's profile directory? Privacy Visibility `validate:"required_without=Domain,omitempty,oneof=public unlocked followers_only mutuals_only direct" bun:",nullzero"` // Default post privacy for this account - Sensitive bool `validate:"-" bun:",default:false"` // Set posts from this account to sensitive by default? + Sensitive *bool `validate:"-" bun:",default:false"` // Set posts from this account to sensitive by default? Language string `validate:"omitempty,bcp47_language_tag" bun:",nullzero,notnull,default:'en'"` // What language does this account post in? StatusFormat string `validate:"required_without=Domain,omitempty,oneof=plain markdown" bun:",nullzero"` // What is the default format for statuses posted by this account (only for local accounts). URI string `validate:"required,url" bun:",nullzero,notnull,unique"` // ActivityPub URI for this account. @@ -70,7 +70,7 @@ type Account struct { SensitizedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account set to have all its media shown as sensitive? SilencedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account silenced (eg., statuses only visible to followers, not public)? SuspendedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account suspended (eg., don't allow it to log in/post, don't accept media/posts from this account) - HideCollections bool `validate:"-" bun:",default:false"` // Hide this account's collections + HideCollections *bool `validate:"-" bun:",default:false"` // Hide this account's collections SuspensionOrigin string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // id of the database entry that caused this account to become suspended -- can be an account ID or a domain block ID } -- cgit v1.2.3