fix: remove redundant array creation

This commit is contained in:
nivedin
2023-12-29 19:54:13 +05:30
committed by Andrew Bastin
parent 53e013e2a4
commit 52ef2d8d32

View File

@@ -1085,7 +1085,7 @@ export default class NewTeamCollectionAdapter {
authType: "inherit", authType: "inherit",
authActive: true, authActive: true,
} }
auth.parentID = [...path.slice(0, i + 1)].join("/") auth.parentID = path.slice(0, i + 1).join("/")
auth.parentName = parentFolder.title auth.parentName = parentFolder.title
} }
@@ -1096,10 +1096,10 @@ export default class NewTeamCollectionAdapter {
if ( if (
parentFolderAuth?.authType === "inherit" && parentFolderAuth?.authType === "inherit" &&
[...path.slice(0, i + 1)].length === 1 path.slice(0, i + 1).length === 1
) { ) {
auth = { auth = {
parentID: [...path.slice(0, i + 1)].join("/"), parentID: path.slice(0, i + 1).join("/"),
parentName: parentFolder.title, parentName: parentFolder.title,
inheritedAuth: auth.inheritedAuth, inheritedAuth: auth.inheritedAuth,
} }
@@ -1107,7 +1107,7 @@ export default class NewTeamCollectionAdapter {
if (parentFolderAuth?.authType !== "inherit") { if (parentFolderAuth?.authType !== "inherit") {
auth = { auth = {
parentID: [...path.slice(0, i + 1)].join("/"), parentID: path.slice(0, i + 1).join("/"),
parentName: parentFolder.title, parentName: parentFolder.title,
inheritedAuth: parentFolderAuth, inheritedAuth: parentFolderAuth,
} }
@@ -1120,7 +1120,7 @@ export default class NewTeamCollectionAdapter {
const index = headers.findIndex( const index = headers.findIndex(
(h) => h.inheritedHeader?.key === header.key (h) => h.inheritedHeader?.key === header.key
) )
const currentPath = [...path.slice(0, i + 1)].join("/") const currentPath = path.slice(0, i + 1).join("/")
if (index !== -1) { if (index !== -1) {
// Replace the existing header with the same key // Replace the existing header with the same key
headers[index] = { headers[index] = {