1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 23:13:36 +00:00

[PM-25402] auto-assign new logins to current folder/collection (#16268)

* auto-assign selected collection for new vault items

* Ensure a selected collectionId in the vault filter is passed on to a newly created cipher.

Fixes #15485

* Assign selected folder and collection when creating a new cipher

Added here to prevent a regression whenever we switch over to this componet and deprecate vault-v2.component

* account for null folderIds

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com>
Co-authored-by: jaasen-livefront <jaasen@livefront.com>
This commit is contained in:
Zhaolin Liang
2026-01-09 07:19:56 +08:00
committed by GitHub
parent eedc36cf39
commit 4aa69a769b
2 changed files with 10 additions and 10 deletions

View File

@@ -34,7 +34,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { getByIds } from "@bitwarden/common/platform/misc";
import { SyncService } from "@bitwarden/common/platform/sync";
import { CipherId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
import { CipherId, CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
import { CipherArchiveService } from "@bitwarden/common/vault/abstractions/cipher-archive.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
@@ -158,7 +158,7 @@ export class VaultComponent<C extends CipherViewLike>
cipherId: string | null = null;
favorites = false;
type: CipherType | null = null;
folderId: string | null = null;
folderId: string | null | undefined = null;
collectionId: string | null = null;
organizationId: string | null = null;
myVaultOnly = false;
@@ -980,9 +980,7 @@ export class VaultComponent<C extends CipherViewLike>
// clear out organizationId when the user switches to a personal vault filter
this.addOrganizationId = null;
}
if (this.activeFilter.selectedFolderId && this.activeFilter.selectedFolder) {
this.folderId = this.activeFilter.selectedFolderId;
}
this.folderId = this.activeFilter.selectedFolderId;
if (this.config == null) {
return;
@@ -990,7 +988,9 @@ export class VaultComponent<C extends CipherViewLike>
this.config.initialValues = {
...this.config.initialValues,
folderId: this.folderId,
organizationId: this.addOrganizationId as OrganizationId,
collectionIds: this.addCollectionIds as CollectionId[],
};
}

View File

@@ -45,7 +45,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { getByIds } from "@bitwarden/common/platform/misc";
import { SyncService } from "@bitwarden/common/platform/sync";
import { CipherId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
import { CipherId, CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
import { CipherArchiveService } from "@bitwarden/common/vault/abstractions/cipher-archive.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
@@ -172,7 +172,7 @@ export class VaultV2Component<C extends CipherViewLike>
cipherId: string | null = null;
favorites = false;
type: CipherType | null = null;
folderId: string | null = null;
folderId: string | null | undefined = null;
collectionId: string | null = null;
organizationId: OrganizationId | null = null;
myVaultOnly = false;
@@ -1016,9 +1016,7 @@ export class VaultV2Component<C extends CipherViewLike>
// clear out organizationId when the user switches to a personal vault filter
this.addOrganizationId = null;
}
if (this.activeFilter.selectedFolderId && this.activeFilter.selectedFolder) {
this.folderId = this.activeFilter.selectedFolderId;
}
this.folderId = this.activeFilter.selectedFolderId;
if (this.config == null) {
return;
@@ -1027,6 +1025,8 @@ export class VaultV2Component<C extends CipherViewLike>
this.config.initialValues = {
...this.config.initialValues,
organizationId: this.addOrganizationId as OrganizationId,
folderId: this.folderId,
collectionIds: this.addCollectionIds as CollectionId[],
};
}