mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-08 09:23:16 -06:00
more big changes
This commit is contained in:
parent
b9746a30f3
commit
4e054233da
71 changed files with 640 additions and 405 deletions
|
|
@ -87,7 +87,7 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
|
|||
a, err := f.db.GetAccountByURI(ctx, id.String())
|
||||
if err == nil {
|
||||
// it's an account
|
||||
l.Debugf("uri is for an account with id: %s", s.ID)
|
||||
l.Debugf("uri is for an account with id: %s", a.ID)
|
||||
if err := f.db.DeleteByID(ctx, a.ID, >smodel.Account{}); err != nil {
|
||||
return fmt.Errorf("DELETE: err deleting account: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,17 @@ func (f *federatingDB) Followers(ctx context.Context, actorIRI *url.URL) (follow
|
|||
followers = streams.NewActivityStreamsCollection()
|
||||
items := streams.NewActivityStreamsItemsProperty()
|
||||
for _, follow := range acctFollowers {
|
||||
gtsFollower := >smodel.Account{}
|
||||
if err := f.db.GetByID(ctx, follow.AccountID, gtsFollower); err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: db error getting account id %s: %s", follow.AccountID, err)
|
||||
if follow.Account == nil {
|
||||
followAccount, err := f.db.GetAccountByID(ctx, follow.AccountID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: db error getting account id %s: %s", follow.AccountID, err)
|
||||
}
|
||||
follow.Account = followAccount
|
||||
}
|
||||
uri, err := url.Parse(gtsFollower.URI)
|
||||
|
||||
uri, err := url.Parse(follow.Account.URI)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: error parsing %s as url: %s", gtsFollower.URI, err)
|
||||
return nil, fmt.Errorf("FOLLOWERS: error parsing %s as url: %s", follow.Account.URI, err)
|
||||
}
|
||||
items.AppendIRI(uri)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,13 +64,17 @@ func (f *federatingDB) Following(ctx context.Context, actorIRI *url.URL) (follow
|
|||
following = streams.NewActivityStreamsCollection()
|
||||
items := streams.NewActivityStreamsItemsProperty()
|
||||
for _, follow := range acctFollowing {
|
||||
gtsFollowing := >smodel.Account{}
|
||||
if err := f.db.GetByID(ctx, follow.AccountID, gtsFollowing); err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWING: db error getting account id %s: %s", follow.AccountID, err)
|
||||
if follow.Account == nil {
|
||||
followAccount, err := f.db.GetAccountByID(ctx, follow.AccountID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWING: db error getting account id %s: %s", follow.AccountID, err)
|
||||
}
|
||||
follow.Account = followAccount
|
||||
}
|
||||
uri, err := url.Parse(gtsFollowing.URI)
|
||||
|
||||
uri, err := url.Parse(follow.Account.URI)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWING: error parsing %s as url: %s", gtsFollowing.URI, err)
|
||||
return nil, fmt.Errorf("FOLLOWING: error parsing %s as url: %s", follow.Account.URI, err)
|
||||
}
|
||||
items.AppendIRI(uri)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error {
|
|||
}
|
||||
|
||||
updatedAcct.ID = requestingAcct.ID // set this here so the db will update properly instead of trying to PUT this and getting constraint issues
|
||||
if err := f.db.UpdateByID(ctx, requestingAcct.ID, updatedAcct); err != nil {
|
||||
updatedAcct, err = f.db.UpdateAccount(ctx, updatedAcct)
|
||||
if err != nil {
|
||||
return fmt.Errorf("UPDATE: database error inserting updated account: %s", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue