From 1ced0bcdbd7588a9f807e8834b7e942bade209eb Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 31 Oct 2025 08:36:12 +0800 Subject: [PATCH] chore: fix linter --- server/router/api/v1/activity_service.go | 4 ++-- server/router/api/v1/user_service.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/router/api/v1/activity_service.go b/server/router/api/v1/activity_service.go index 49cd1c6ed..bcd0c9716 100644 --- a/server/router/api/v1/activity_service.go +++ b/server/router/api/v1/activity_service.go @@ -117,7 +117,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl if memo == nil { return nil, status.Errorf(codes.NotFound, "memo does not exist") } - + // Fetch the related memo (the one being commented on) relatedMemo, err := s.Store.GetMemo(ctx, &store.FindMemo{ ID: &payload.MemoComment.RelatedMemoId, @@ -126,7 +126,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl if err != nil { return nil, status.Errorf(codes.Internal, "failed to get related memo: %v", err) } - + v2Payload.Payload = &v1pb.ActivityPayload_MemoComment{ MemoComment: &v1pb.ActivityMemoCommentPayload{ Memo: fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID), diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index 84649926d..a836a8c53 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -1645,6 +1645,8 @@ func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb return nil, status.Errorf(codes.InvalidArgument, "invalid status") } update.Status = inboxStatus + default: + return nil, status.Errorf(codes.InvalidArgument, "invalid update path: %s", path) } } @@ -1700,7 +1702,7 @@ func (s *APIV1Service) DeleteUserNotification(ctx context.Context, request *v1pb // convertInboxToUserNotification converts a storage-layer inbox to an API notification. // This handles the mapping between the internal inbox representation and the public API. -func (s *APIV1Service) convertInboxToUserNotification(ctx context.Context, inbox *store.Inbox) (*v1pb.UserNotification, error) { +func (*APIV1Service) convertInboxToUserNotification(_ context.Context, inbox *store.Inbox) (*v1pb.UserNotification, error) { notification := &v1pb.UserNotification{ Name: fmt.Sprintf("users/%d/notifications/%d", inbox.ReceiverID, inbox.ID), Sender: fmt.Sprintf("%s%d", UserNamePrefix, inbox.SenderID), @@ -1735,7 +1737,7 @@ func (s *APIV1Service) convertInboxToUserNotification(ctx context.Context, inbox } // ExtractNotificationIDFromName extracts the notification ID from a resource name. -// Expected format: users/{user_id}/notifications/{notification_id} +// Expected format: users/{user_id}/notifications/{notification_id}. func ExtractNotificationIDFromName(name string) (int32, error) { pattern := regexp.MustCompile(`^users/(\d+)/notifications/(\d+)$`) matches := pattern.FindStringSubmatch(name)