mirror of https://github.com/usememos/memos.git
chore: fix linter
This commit is contained in:
parent
bc1550e926
commit
1ced0bcdbd
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue