mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-12 10:18:06 -06:00
Pg to bun (#148)
* start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes
This commit is contained in:
parent
071eca20ce
commit
2dc9fc1626
713 changed files with 98694 additions and 22704 deletions
|
|
@ -19,7 +19,7 @@ import (
|
|||
// If modified, the library will then call Update.
|
||||
//
|
||||
// The library makes this call only after acquiring a lock first.
|
||||
func (f *federatingDB) Followers(c context.Context, actorIRI *url.URL) (followers vocab.ActivityStreamsCollection, err error) {
|
||||
func (f *federatingDB) Followers(ctx context.Context, actorIRI *url.URL) (followers vocab.ActivityStreamsCollection, err error) {
|
||||
l := f.log.WithFields(
|
||||
logrus.Fields{
|
||||
"func": "Followers",
|
||||
|
|
@ -31,19 +31,19 @@ func (f *federatingDB) Followers(c context.Context, actorIRI *url.URL) (follower
|
|||
acct := >smodel.Account{}
|
||||
|
||||
if util.IsUserPath(actorIRI) {
|
||||
acct, err = f.db.GetAccountByURI(actorIRI.String())
|
||||
acct, err = f.db.GetAccountByURI(ctx, actorIRI.String())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: db error getting account with uri %s: %s", actorIRI.String(), err)
|
||||
}
|
||||
} else if util.IsFollowersPath(actorIRI) {
|
||||
if err := f.db.GetWhere([]db.Where{{Key: "followers_uri", Value: actorIRI.String()}}, acct); err != nil {
|
||||
if err := f.db.GetWhere(ctx, []db.Where{{Key: "followers_uri", Value: actorIRI.String()}}, acct); err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: db error getting account with followers uri %s: %s", actorIRI.String(), err)
|
||||
}
|
||||
} else {
|
||||
return nil, fmt.Errorf("FOLLOWERS: could not parse actor IRI %s as users or followers path", actorIRI.String())
|
||||
}
|
||||
|
||||
acctFollowers, err := f.db.GetAccountFollowedBy(acct.ID, false)
|
||||
acctFollowers, err := f.db.GetAccountFollowedBy(ctx, acct.ID, false)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("FOLLOWERS: db error getting followers for account id %s: %s", acct.ID, err)
|
||||
}
|
||||
|
|
@ -51,13 +51,17 @@ func (f *federatingDB) Followers(c context.Context, actorIRI *url.URL) (follower
|
|||
followers = streams.NewActivityStreamsCollection()
|
||||
items := streams.NewActivityStreamsItemsProperty()
|
||||
for _, follow := range acctFollowers {
|
||||
gtsFollower := >smodel.Account{}
|
||||
if err := f.db.GetByID(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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue