chore: when creating new tag from link input, move it to the vault the item is in before linking

This commit is contained in:
Aman Harwara
2023-09-21 21:46:46 +05:30
parent d55d0eb806
commit febaf5185d

View File

@@ -302,7 +302,17 @@ export class LinkingController extends AbstractViewController implements Interna
const activeItem = this.activeItem
if (activeItem) {
await this.addTagToItem(newTag, activeItem)
const itemVault = this.vaults.getItemVault(activeItem)
if (itemVault) {
const movedTag = await this.vaults.moveItemToVault(itemVault, newTag)
if (!movedTag) {
throw new Error('Failed to move tag to item vault')
}
await this.addTagToItem(movedTag as SNTag, activeItem)
} else {
await this.addTagToItem(newTag, activeItem)
}
}
return newTag