try fix again.
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-07-26 20:50:03 +02:00
parent 4bccdc2ded
commit bd27b14a88
3 changed files with 14 additions and 6 deletions
+8 -1
View File
@@ -56,7 +56,7 @@ func (s *AuthService) FindKey(ctx context.Context, id string) (*models.Key, erro
return s.keys.Find(ctx, id)
}
// FindKey finds a key by id.
// FindUser finds a user by id.
func (s *AuthService) FindUser(ctx context.Context, id string) (*models.User, error) {
return s.users.Find(ctx, id)
}
@@ -154,6 +154,13 @@ func (s *AuthService) TokenFromContext(ctx context.Context) *models.Token {
return token
}
// SpinOffContext adds the auth token to a background context.
func (s *AuthService) SpinOffContext(ctx context.Context) context.Context {
token := s.TokenFromContext(ctx)
return context.WithValue(context.Background(), contextKey, &token)
}
// RequestWithToken either returns the request, or the request with a new context that
// has the token.
func (s *AuthService) RequestWithToken(r *http.Request) *http.Request {
+1
View File
@@ -484,6 +484,7 @@ func (s *LogService) EditPost(ctx context.Context, id string, update models.Post
return nil, err
}
ctx = s.authService.SpinOffContext(ctx)
go func() {
l, err := s.logs.Find(context.Background(), post.LogID)
if err != nil {