From a4aa808103bbeaffa7d4ab0c7d6de0c954b357b6 Mon Sep 17 00:00:00 2001 From: nivedin Date: Wed, 20 Dec 2023 22:22:05 +0530 Subject: [PATCH] chore: minor update for team header-auth properties --- .../src/helpers/teams/TeamCollectionAdapter.ts | 10 +++++++++- packages/hoppscotch-common/src/newstore/collections.ts | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-common/src/helpers/teams/TeamCollectionAdapter.ts b/packages/hoppscotch-common/src/helpers/teams/TeamCollectionAdapter.ts index b6a1e0863..dfddae15f 100644 --- a/packages/hoppscotch-common/src/helpers/teams/TeamCollectionAdapter.ts +++ b/packages/hoppscotch-common/src/helpers/teams/TeamCollectionAdapter.ts @@ -1034,6 +1034,11 @@ export default class NewTeamCollectionAdapter { } } + /** + * Used to obtain the inherited auth and headers for a given folder path, used for both REST and GraphQL team collections + * @param folderPath the path of the folder to cascade the auth from + * @returns the inherited auth and headers for the given folder path + */ public cascadeParentCollectionForHeaderAuth(folderPath: string) { let auth: HoppInheritedProperty["auth"] = { parentID: folderPath ?? "", @@ -1089,7 +1094,10 @@ export default class NewTeamCollectionAdapter { const parentFolderAuth = data.auth const parentFolderHeaders = data.headers - if (parentFolderAuth?.authType === "inherit" && path.length === 1) { + if ( + parentFolderAuth?.authType === "inherit" && + [...path.slice(0, i + 1)].length === 1 + ) { auth = { parentID: [...path.slice(0, i + 1)].join("/"), parentName: parentFolder.title, diff --git a/packages/hoppscotch-common/src/newstore/collections.ts b/packages/hoppscotch-common/src/newstore/collections.ts index a23042a7f..91cdbb364 100644 --- a/packages/hoppscotch-common/src/newstore/collections.ts +++ b/packages/hoppscotch-common/src/newstore/collections.ts @@ -68,7 +68,7 @@ export function navigateToFolderWithIndexPath( } /** - * Used to obtain the inherited auth and headers for a given folder path, used for both REST and GraphQL + * Used to obtain the inherited auth and headers for a given folder path, used for both REST and GraphQL personal collections * @param folderPath the path of the folder to cascade the auth from * @param type the type of collection * @returns the inherited auth and headers for the given folder path