diff options
author | 2021-08-25 15:34:33 +0200 | |
---|---|---|
committer | 2021-08-25 15:34:33 +0200 | |
commit | 2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch) | |
tree | 4ddeac479b923db38090aac8bd9209f3646851c1 /internal/processing/account/getstatuses.go | |
parent | Manually approves followers (#146) (diff) | |
download | gotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz |
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
Diffstat (limited to 'internal/processing/account/getstatuses.go')
-rw-r--r-- | internal/processing/account/getstatuses.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/processing/account/getstatuses.go b/internal/processing/account/getstatuses.go index dc21e7006..dc157e43c 100644 --- a/internal/processing/account/getstatuses.go +++ b/internal/processing/account/getstatuses.go @@ -19,6 +19,7 @@ package account import ( + "context" "fmt" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" @@ -27,8 +28,8 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" ) -func (p *processor) StatusesGet(requestingAccount *gtsmodel.Account, targetAccountID string, limit int, excludeReplies bool, maxID string, pinnedOnly bool, mediaOnly bool) ([]apimodel.Status, gtserror.WithCode) { - if blocked, err := p.db.IsBlocked(requestingAccount.ID, targetAccountID, true); err != nil { +func (p *processor) StatusesGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string, limit int, excludeReplies bool, maxID string, pinnedOnly bool, mediaOnly bool) ([]apimodel.Status, 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")) @@ -36,7 +37,7 @@ func (p *processor) StatusesGet(requestingAccount *gtsmodel.Account, targetAccou apiStatuses := []apimodel.Status{} - statuses, err := p.db.GetAccountStatuses(targetAccountID, limit, excludeReplies, maxID, pinnedOnly, mediaOnly) + statuses, err := p.db.GetAccountStatuses(ctx, targetAccountID, limit, excludeReplies, maxID, pinnedOnly, mediaOnly) if err != nil { if err == db.ErrNoEntries { return apiStatuses, nil @@ -45,12 +46,12 @@ func (p *processor) StatusesGet(requestingAccount *gtsmodel.Account, targetAccou } for _, s := range statuses { - visible, err := p.filter.StatusVisible(s, requestingAccount) + visible, err := p.filter.StatusVisible(ctx, s, requestingAccount) if err != nil || !visible { continue } - apiStatus, err := p.tc.StatusToMasto(s, requestingAccount) + apiStatus, err := p.tc.StatusToMasto(ctx, s, requestingAccount) if err != nil { return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status to masto: %s", err)) } |