Commit 1ced0bcd authored by Steven's avatar Steven

chore: fix linter

parent bc1550e9
...@@ -117,7 +117,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl ...@@ -117,7 +117,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl
if memo == nil { if memo == nil {
return nil, status.Errorf(codes.NotFound, "memo does not exist") return nil, status.Errorf(codes.NotFound, "memo does not exist")
} }
// Fetch the related memo (the one being commented on) // Fetch the related memo (the one being commented on)
relatedMemo, err := s.Store.GetMemo(ctx, &store.FindMemo{ relatedMemo, err := s.Store.GetMemo(ctx, &store.FindMemo{
ID: &payload.MemoComment.RelatedMemoId, ID: &payload.MemoComment.RelatedMemoId,
...@@ -126,7 +126,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl ...@@ -126,7 +126,7 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get related memo: %v", err) return nil, status.Errorf(codes.Internal, "failed to get related memo: %v", err)
} }
v2Payload.Payload = &v1pb.ActivityPayload_MemoComment{ v2Payload.Payload = &v1pb.ActivityPayload_MemoComment{
MemoComment: &v1pb.ActivityMemoCommentPayload{ MemoComment: &v1pb.ActivityMemoCommentPayload{
Memo: fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID), Memo: fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID),
......
...@@ -1645,6 +1645,8 @@ func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb ...@@ -1645,6 +1645,8 @@ func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb
return nil, status.Errorf(codes.InvalidArgument, "invalid status") return nil, status.Errorf(codes.InvalidArgument, "invalid status")
} }
update.Status = inboxStatus 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 ...@@ -1700,7 +1702,7 @@ func (s *APIV1Service) DeleteUserNotification(ctx context.Context, request *v1pb
// convertInboxToUserNotification converts a storage-layer inbox to an API notification. // convertInboxToUserNotification converts a storage-layer inbox to an API notification.
// This handles the mapping between the internal inbox representation and the public API. // 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{ notification := &v1pb.UserNotification{
Name: fmt.Sprintf("users/%d/notifications/%d", inbox.ReceiverID, inbox.ID), Name: fmt.Sprintf("users/%d/notifications/%d", inbox.ReceiverID, inbox.ID),
Sender: fmt.Sprintf("%s%d", UserNamePrefix, inbox.SenderID), Sender: fmt.Sprintf("%s%d", UserNamePrefix, inbox.SenderID),
...@@ -1735,7 +1737,7 @@ func (s *APIV1Service) convertInboxToUserNotification(ctx context.Context, inbox ...@@ -1735,7 +1737,7 @@ func (s *APIV1Service) convertInboxToUserNotification(ctx context.Context, inbox
} }
// ExtractNotificationIDFromName extracts the notification ID from a resource name. // 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) { func ExtractNotificationIDFromName(name string) (int32, error) {
pattern := regexp.MustCompile(`^users/(\d+)/notifications/(\d+)$`) pattern := regexp.MustCompile(`^users/(\d+)/notifications/(\d+)$`)
matches := pattern.FindStringSubmatch(name) matches := pattern.FindStringSubmatch(name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment