chore: update tag rename

This commit is contained in:
Steven
2024-01-27 05:26:32 +08:00
parent 566171783d
commit b9cbe6626f
5 changed files with 15 additions and 11 deletions

View File

@@ -233,6 +233,7 @@ func (s *APIV1Service) UploadResource(c echo.Context) error {
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create resource").SetInternal(err)
}
metric.Enqueue("resource create")
return c.JSON(http.StatusOK, convertResourceFromStore(resource))
}

View File

@@ -11,6 +11,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
apiv2pb "github.com/usememos/memos/proto/gen/api/v2"
"github.com/usememos/memos/server/service/metric"
"github.com/usememos/memos/store"
)
@@ -44,6 +45,8 @@ func (s *APIV2Service) CreateResource(ctx context.Context, request *apiv2pb.Crea
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to create resource: %v", err)
}
metric.Enqueue("resource create")
return &apiv2pb.CreateResourceResponse{
Resource: s.convertResourceFromStore(ctx, resource),
}, nil

View File

@@ -104,7 +104,7 @@ func (s *APIV2Service) RenameTag(ctx context.Context, request *apiv2pb.RenameTag
return nil, status.Errorf(codes.Internal, "failed to parse memo: %v", err)
}
traverseASTNodes(nodes, func(node ast.Node) {
if tag, ok := node.(*ast.Tag); ok {
if tag, ok := node.(*ast.Tag); ok && tag.Content == request.OldName {
tag.Content = request.NewName
}
})