summaryrefslogtreecommitdiff
path: root/internal/transport/controller.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-25 15:34:33 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-25 15:34:33 +0200
commit2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch)
tree4ddeac479b923db38090aac8bd9209f3646851c1 /internal/transport/controller.go
parentManually approves followers (#146) (diff)
downloadgotosocial-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/transport/controller.go')
-rw-r--r--internal/transport/controller.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/transport/controller.go b/internal/transport/controller.go
index 4eb6b5658..c2f5026e0 100644
--- a/internal/transport/controller.go
+++ b/internal/transport/controller.go
@@ -19,6 +19,7 @@
package transport
import (
+ "context"
"crypto"
"fmt"
"sync"
@@ -33,7 +34,7 @@ import (
// Controller generates transports for use in making federation requests to other servers.
type Controller interface {
NewTransport(pubKeyID string, privkey crypto.PrivateKey) (Transport, error)
- NewTransportForUsername(username string) (Transport, error)
+ NewTransportForUsername(ctx context.Context, username string) (Transport, error)
}
type controller struct {
@@ -90,7 +91,7 @@ func (c *controller) NewTransport(pubKeyID string, privkey crypto.PrivateKey) (T
}, nil
}
-func (c *controller) NewTransportForUsername(username string) (Transport, error) {
+func (c *controller) NewTransportForUsername(ctx context.Context, username string) (Transport, error) {
// We need an account to use to create a transport for dereferecing something.
// If a username has been given, we can fetch the account with that username and use it.
// Otherwise, we can take the instance account and use those credentials to make the request.
@@ -101,7 +102,7 @@ func (c *controller) NewTransportForUsername(username string) (Transport, error)
u = username
}
- ourAccount, err := c.db.GetLocalAccountByUsername(u)
+ ourAccount, err := c.db.GetLocalAccountByUsername(ctx, u)
if err != nil {
return nil, fmt.Errorf("error getting account %s from db: %s", username, err)
}