mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-05 21:08:07 -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,6 +19,7 @@
|
|||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
|
||||
|
|
@ -27,15 +28,15 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
)
|
||||
|
||||
func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAccountID string) ([]apimodel.Account, gtserror.WithCode) {
|
||||
if blocked, err := p.db.IsBlocked(requestingAccount.ID, targetAccountID, true); err != nil {
|
||||
func (p *processor) FollowersGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) ([]apimodel.Account, gtserror.WithCode) {
|
||||
if blocked, err := p.db.IsBlocked(ctx, requestingAccount.ID, targetAccountID, true); err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
} else if blocked {
|
||||
return nil, gtserror.NewErrorNotFound(fmt.Errorf("block exists between accounts"))
|
||||
}
|
||||
|
||||
accounts := []apimodel.Account{}
|
||||
follows, err := p.db.GetAccountFollowedBy(targetAccountID, false)
|
||||
follows, err := p.db.GetAccountFollowedBy(ctx, targetAccountID, false)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
return accounts, nil
|
||||
|
|
@ -44,7 +45,7 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
}
|
||||
|
||||
for _, f := range follows {
|
||||
blocked, err := p.db.IsBlocked(requestingAccount.ID, f.AccountID, true)
|
||||
blocked, err := p.db.IsBlocked(ctx, requestingAccount.ID, f.AccountID, true)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
|
@ -53,7 +54,7 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
}
|
||||
|
||||
if f.Account == nil {
|
||||
a, err := p.db.GetAccountByID(f.AccountID)
|
||||
a, err := p.db.GetAccountByID(ctx, f.AccountID)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
continue
|
||||
|
|
@ -63,7 +64,7 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
|
|||
f.Account = a
|
||||
}
|
||||
|
||||
account, err := p.tc.AccountToMastoPublic(f.Account)
|
||||
account, err := p.tc.AccountToMastoPublic(ctx, f.Account)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue