chore: handle moving & removing tags with subtags into/out of vaults (#2528)

This commit is contained in:
Aman Harwara
2023-09-26 16:40:09 +05:30
committed by GitHub
parent fe0cd96883
commit 60f96bc201
3 changed files with 47 additions and 6 deletions

View File

@@ -702,6 +702,18 @@ export class ItemManager extends Services.AbstractService implements Services.It
return tags.filter((tag) => tag.parentId === itemToLookupUuidFor.uuid)
}
public getDeepTagChildren(itemToLookupUuidFor: Models.SNTag): Models.SNTag[] {
const allChildren: Models.SNTag[] = []
const children = this.getTagChildren(itemToLookupUuidFor)
for (const child of children) {
allChildren.push(child)
allChildren.push(...this.getDeepTagChildren(child))
}
return allChildren
}
public isTagAncestor(tagToLookUpUuidFor: Models.SNTag, childToLookUpUuidFor: Models.SNTag): boolean {
const tag = this.findItem<Models.SNTag>(childToLookUpUuidFor.uuid)
if (!tag) {