Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: fix linter
Steven174b1a03613f
diff --git a/proto/api/v1/activity_service.proto b/proto/api/v1/activity_service.protoindex bb675fff6..7b33936f8 100644--- a/proto/api/v1/activity_service.proto+++ b/proto/api/v1/activity_service.proto@@ -122,8 +122,6 @@ message GetActivityRequest {// Format: activities/{id}, id is the system generated auto-incremented id.string name = 1 [(google.api.field_behavior) = REQUIRED,- (google.api.resource_reference) = {- type: "memos.api.v1/Activity"- }+ (google.api.resource_reference) = {type: "memos.api.v1/Activity"}];}diff --git a/server/router/api/v1/test/test_helper.go b/server/router/api/v1/test/test_helper.goindex a2fe0ea86..f4ea12f7e 100644--- a/server/router/api/v1/test/test_helper.go+++ b/server/router/api/v1/test/test_helper.go@@ -75,7 +75,7 @@ func (ts *TestService) CreateRegularUser(ctx context.Context, username string) (}// 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 packagereturn apiv1.CreateTestUserContext(ctx, username)}diff --git a/server/router/api/v1/test_auth.go b/server/router/api/v1/test_auth.goindex 7a1a36d75..840785200 100644--- a/server/router/api/v1/test_auth.go+++ b/server/router/api/v1/test_auth.go@@ -6,14 +6,14 @@ import ("github.com/usememos/memos/store")-// CreateTestUserContext creates a context with username for testing purposes-// This function is only intended for use in tests+// CreateTestUserContext creates a context with username for testing purposes.+// This function is only intended for use in tests.func CreateTestUserContext(ctx context.Context, username string) context.Context {return context.WithValue(ctx, usernameContextKey, username)}-// CreateTestUserContextWithUser creates a context and ensures the user exists for testing-// This function is only intended for use in tests-func CreateTestUserContextWithUser(ctx context.Context, s *APIV1Service, user *store.User) context.Context {+// CreateTestUserContextWithUser creates a context and ensures the user exists for testing.+// This function is only intended for use in tests.+func CreateTestUserContextWithUser(ctx context.Context, _ *APIV1Service, user *store.User) context.Context {return context.WithValue(ctx, usernameContextKey, user.Username)}diff --git a/server/router/api/v1/webhook_service.go b/server/router/api/v1/webhook_service.goindex 9d84289ba..55a7765fb 100644--- a/server/router/api/v1/webhook_service.go+++ b/server/router/api/v1/webhook_service.go@@ -25,19 +25,20 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWereturn nil, status.Errorf(codes.Unauthenticated, "user not authenticated")}+ // Only host users can create webhooks+ if !isSuperUser(currentUser) {+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")+ }-// Only host users can create webhooks-if !isSuperUser(currentUser) {-return nil, status.Errorf(codes.PermissionDenied, "permission denied")-}+ // Validate required fields+ if request.Webhook == nil {+ return nil, status.Errorf(codes.InvalidArgument, "webhook is required")+ }+ if strings.TrimSpace(request.Webhook.Url) == "" {+ return nil, status.Errorf(codes.InvalidArgument, "webhook URL is required")+ }-// Validate required fields-if request.Webhook == nil {-return nil, status.Errorf(codes.InvalidArgument, "webhook is required")-}-if strings.TrimSpace(request.Webhook.Url) == "" {-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 fieldsif request.ValidateOnly {// Perform validation checks without actually creating the webhookreturn &v1pb.Webhook{