From 1d13f3062cdf40a11b3debd15caf2ca4c8551cc1 Mon Sep 17 00:00:00 2001 From: yubonluo Date: Thu, 21 Nov 2024 09:58:54 +0800 Subject: [PATCH] optimize the function name Signed-off-by: yubonluo --- .../saved_objects/workspace_id_consumer_wrapper.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts b/src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts index ce30228b0e08..a815cbfe4a7f 100644 --- a/src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts +++ b/src/plugins/workspace/server/saved_objects/workspace_id_consumer_wrapper.ts @@ -53,7 +53,7 @@ export class WorkspaceIdConsumerWrapper { // If the object.workspaces is null/[] (as global object), return it directly. // If the workspace is specified, validate whether the object exists in the workspace. - private validateObjectExistInWorkspaces( + private formatObjectForWorkspaceValidation( object: SavedObject, workspace: string ): SavedObject { @@ -160,7 +160,7 @@ export class WorkspaceIdConsumerWrapper { return { ...objectToBulkGet, saved_objects: objectToBulkGet.saved_objects.map((object) => - this.validateObjectExistInWorkspaces(object, workspaces[0]) + this.formatObjectForWorkspaceValidation(object, workspaces[0]) ), }; } @@ -176,7 +176,10 @@ export class WorkspaceIdConsumerWrapper { const { workspaces } = this.formatWorkspaceIdParams(wrapperOptions.request, options); if (workspaces?.length === 1) { - const validatedObject = this.validateObjectExistInWorkspaces(objectToGet, workspaces[0]); + const validatedObject = this.formatObjectForWorkspaceValidation( + objectToGet, + workspaces[0] + ); if (validatedObject.error) { throw SavedObjectsErrorHelpers.createGenericNotFoundError(type, id); }