chore: fix linter

pull/4778/head
Steven 2 weeks ago
parent 760c164328
commit 174b1a0361

@ -122,8 +122,6 @@ message GetActivityRequest {
// Format: activities/{id}, id is the system generated auto-incremented id. // Format: activities/{id}, id is the system generated auto-incremented id.
string name = 1 [ string name = 1 [
(google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { (google.api.resource_reference) = {type: "memos.api.v1/Activity"}
type: "memos.api.v1/Activity"
}
]; ];
} }

@ -75,7 +75,7 @@ func (ts *TestService) CreateRegularUser(ctx context.Context, username string) (
} }
// CreateUserContext creates a context with the given username for authentication. // CreateUserContext creates a context with the given username for authentication.
func (ts *TestService) CreateUserContext(ctx context.Context, username string) context.Context { func (*TestService) CreateUserContext(ctx context.Context, username string) context.Context {
// Use the real context key from the parent package // Use the real context key from the parent package
return apiv1.CreateTestUserContext(ctx, username) return apiv1.CreateTestUserContext(ctx, username)
} }

@ -6,14 +6,14 @@ import (
"github.com/usememos/memos/store" "github.com/usememos/memos/store"
) )
// CreateTestUserContext creates a context with username for testing purposes // CreateTestUserContext creates a context with username for testing purposes.
// This function is only intended for use in tests // This function is only intended for use in tests.
func CreateTestUserContext(ctx context.Context, username string) context.Context { func CreateTestUserContext(ctx context.Context, username string) context.Context {
return context.WithValue(ctx, usernameContextKey, username) return context.WithValue(ctx, usernameContextKey, username)
} }
// CreateTestUserContextWithUser creates a context and ensures the user exists for testing // CreateTestUserContextWithUser creates a context and ensures the user exists for testing.
// This function is only intended for use in tests // This function is only intended for use in tests.
func CreateTestUserContextWithUser(ctx context.Context, s *APIV1Service, user *store.User) context.Context { func CreateTestUserContextWithUser(ctx context.Context, _ *APIV1Service, user *store.User) context.Context {
return context.WithValue(ctx, usernameContextKey, user.Username) return context.WithValue(ctx, usernameContextKey, user.Username)
} }

@ -25,7 +25,6 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe
return nil, status.Errorf(codes.Unauthenticated, "user not authenticated") return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
} }
// Only host users can create webhooks // Only host users can create webhooks
if !isSuperUser(currentUser) { if !isSuperUser(currentUser) {
return nil, status.Errorf(codes.PermissionDenied, "permission denied") return nil, status.Errorf(codes.PermissionDenied, "permission denied")
@ -37,7 +36,9 @@ return nil, status.Errorf(codes.InvalidArgument, "webhook is required")
} }
if strings.TrimSpace(request.Webhook.Url) == "" { if strings.TrimSpace(request.Webhook.Url) == "" {
return nil, status.Errorf(codes.InvalidArgument, "webhook URL is required") return nil, status.Errorf(codes.InvalidArgument, "webhook URL is required")
} // TODO: Handle webhook_id, validate_only, and request_id fields }
// TODO: Handle webhook_id, validate_only, and request_id fields
if request.ValidateOnly { if request.ValidateOnly {
// Perform validation checks without actually creating the webhook // Perform validation checks without actually creating the webhook
return &v1pb.Webhook{ return &v1pb.Webhook{

Loading…
Cancel
Save