Updates....

This commit is contained in:
tsmethurst 2021-05-08 11:35:03 +02:00
commit 68f3ba03b2
14 changed files with 128 additions and 316 deletions

View file

@ -35,14 +35,14 @@ func (c *converter) ASRepresentationToAccount(accountable Accountable) (*gtsmode
uri := uriProp.GetIRI()
acct := &gtsmodel.Account{}
if err := c.db.GetWhere("uri", uri.String(), acct); err == nil {
err := c.db.GetWhere("uri", uri.String(), acct)
if err == nil {
// we already know this account so we can skip generating it
return acct, nil
} else {
if _, ok := err.(db.ErrNoEntries); !ok {
// we don't know the account and there's been a real error
return nil, fmt.Errorf("error getting account with uri %s from the database: %s", uri.String(), err)
}
}
if _, ok := err.(db.ErrNoEntries); !ok {
// we don't know the account and there's been a real error
return nil, fmt.Errorf("error getting account with uri %s from the database: %s", uri.String(), err)
}
// we don't know the account so we need to generate it from the person -- at least we already have the URI!

View file

@ -27,6 +27,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
)
// nolint
type ConverterStandardTestSuite struct {
suite.Suite
config *config.Config

View file

@ -120,7 +120,7 @@ func (c *converter) AccountToMastoPublic(a *gtsmodel.Account) (*model.Account, e
aviURLStatic := avi.Thumbnail.URL
header := &gtsmodel.MediaAttachment{}
if err := c.db.GetHeaderForAccountID(avi, a.ID); err != nil {
if err := c.db.GetHeaderForAccountID(header, a.ID); err != nil {
if _, ok := err.(db.ErrNoEntries); !ok {
return nil, fmt.Errorf("error getting header: %s", err)
}