diff options
Diffstat (limited to 'internal/trans')
-rw-r--r-- | internal/trans/import.go | 9 | ||||
-rw-r--r-- | internal/trans/import_test.go | 6 | ||||
-rw-r--r-- | internal/trans/model/account.go | 10 |
3 files changed, 13 insertions, 12 deletions
diff --git a/internal/trans/import.go b/internal/trans/import.go index 0fd539114..c77b439f5 100644 --- a/internal/trans/import.go +++ b/internal/trans/import.go @@ -25,6 +25,7 @@ import ( "io" "os" + "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/log" transmodel "github.com/superseriousbusiness/gotosocial/internal/trans/model" ) @@ -73,6 +74,14 @@ func (i *importer) inputEntry(ctx context.Context, entry transmodel.Entry) error if err := i.putInDB(ctx, account); err != nil { return fmt.Errorf("inputEntry: error adding account to database: %s", err) } + if account.Domain == "" && account.Username != config.GetHost() { + // Local, non-instance account. + // Insert barebones settings model. + settings := &transmodel.AccountSettings{AccountID: account.ID} + if err := i.putInDB(ctx, settings); err != nil { + return fmt.Errorf("inputEntry: error adding account settings to database: %s", err) + } + } log.Infof(ctx, "added account with id %s", account.ID) return nil case transmodel.TransBlock: diff --git a/internal/trans/import_test.go b/internal/trans/import_test.go index ac70efd29..5177ec45b 100644 --- a/internal/trans/import_test.go +++ b/internal/trans/import_test.go @@ -106,11 +106,6 @@ func (suite *ImportMinimalTestSuite) TestImportMinimalOK() { suite.Equal(testAccountBefore.Memorial, testAccountAfter.Memorial) suite.Equal(testAccountBefore.Bot, testAccountAfter.Bot) suite.Equal(testAccountBefore.Locked, testAccountAfter.Locked) - suite.Equal(testAccountBefore.Reason, testAccountAfter.Reason) - suite.Equal(testAccountBefore.Privacy, testAccountAfter.Privacy) - suite.Equal(testAccountBefore.Sensitive, testAccountAfter.Sensitive) - suite.Equal(testAccountBefore.Language, testAccountAfter.Language) - suite.Equal(testAccountBefore.StatusContentType, testAccountAfter.StatusContentType) suite.Equal(testAccountBefore.URI, testAccountAfter.URI) suite.Equal(testAccountBefore.URL, testAccountAfter.URL) suite.Equal(testAccountBefore.InboxURI, testAccountAfter.InboxURI) @@ -123,7 +118,6 @@ func (suite *ImportMinimalTestSuite) TestImportMinimalOK() { suite.Equal(testAccountBefore.PublicKey, testAccountAfter.PublicKey) suite.Equal(testAccountBefore.PublicKeyURI, testAccountAfter.PublicKeyURI) suite.Equal(testAccountBefore.SuspendedAt, testAccountAfter.SuspendedAt) - suite.Equal(testAccountBefore.HideCollections, testAccountAfter.HideCollections) suite.Equal(testAccountBefore.SuspensionOrigin, testAccountAfter.SuspensionOrigin) } diff --git a/internal/trans/model/account.go b/internal/trans/model/account.go index 73695f7be..097dea3a3 100644 --- a/internal/trans/model/account.go +++ b/internal/trans/model/account.go @@ -36,13 +36,8 @@ type Account struct { NoteRaw string `json:"noteRaw,omitempty" bun:",nullzero"` Memorial *bool `json:"memorial"` Bot *bool `json:"bot"` - Reason string `json:"reason,omitempty" bun:",nullzero"` Locked *bool `json:"locked"` Discoverable *bool `json:"discoverable"` - Privacy string `json:"privacy,omitempty" bun:",nullzero"` - Sensitive *bool `json:"sensitive"` - Language string `json:"language,omitempty" bun:",nullzero"` - StatusContentType string `json:"statusContentType,omitempty" bun:",nullzero"` URI string `json:"uri" bun:",nullzero"` URL string `json:"url" bun:",nullzero"` InboxURI string `json:"inboxURI" bun:",nullzero"` @@ -59,6 +54,9 @@ type Account struct { SensitizedAt *time.Time `json:"sensitizedAt,omitempty" bun:",nullzero"` SilencedAt *time.Time `json:"silencedAt,omitempty" bun:",nullzero"` SuspendedAt *time.Time `json:"suspendedAt,omitempty" bun:",nullzero"` - HideCollections *bool `json:"hideCollections"` SuspensionOrigin string `json:"suspensionOrigin,omitempty" bun:",nullzero"` } + +type AccountSettings struct { + AccountID string +} |