1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

[PM-21087][PM-21089][PM-21023][PM-PM-21025] - multiple bug fixes for desktop cipher form (#14614)

* set organizationId for new items

* various bug fixes

* fix duplicate import
This commit is contained in:
Jordan Aasen
2025-05-08 15:42:44 -07:00
committed by GitHub
parent 9b85123acf
commit 7608a5b55b

View File

@@ -29,7 +29,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { SyncService } from "@bitwarden/common/platform/sync"; import { SyncService } from "@bitwarden/common/platform/sync";
import { CipherId, CollectionId, UserId } from "@bitwarden/common/types/guid"; import { CipherId, CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service"; import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service"; import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service";
@@ -530,8 +530,11 @@ export class VaultV2Component implements OnInit, OnDestroy {
} }
async addCipher(type: CipherType) { async addCipher(type: CipherType) {
if (this.action === "add") {
return;
}
this.addType = type || this.activeFilter.cipherType; this.addType = type || this.activeFilter.cipherType;
this.cipherId = null; this.cipher = new CipherView();
await this.buildFormConfig("add"); await this.buildFormConfig("add");
this.action = "add"; this.action = "add";
this.prefillCipherFromFilter(); this.prefillCipherFromFilter();
@@ -744,7 +747,7 @@ export class VaultV2Component implements OnInit, OnDestroy {
private prefillCipherFromFilter() { private prefillCipherFromFilter() {
if (this.activeFilter.selectedCollectionId != null && this.vaultFilterComponent != null) { if (this.activeFilter.selectedCollectionId != null && this.vaultFilterComponent != null) {
const collections = this.vaultFilterComponent.collections.fullList.filter( const collections = this.vaultFilterComponent.collections?.fullList.filter(
(c) => c.id === this.activeFilter.selectedCollectionId, (c) => c.id === this.activeFilter.selectedCollectionId,
); );
if (collections.length > 0) { if (collections.length > 0) {
@@ -757,6 +760,13 @@ export class VaultV2Component implements OnInit, OnDestroy {
if (this.activeFilter.selectedFolderId && this.activeFilter.selectedFolder) { if (this.activeFilter.selectedFolderId && this.activeFilter.selectedFolder) {
this.folderId = this.activeFilter.selectedFolderId; this.folderId = this.activeFilter.selectedFolderId;
} }
if (this.addOrganizationId && this.config) {
this.config.initialValues = {
...this.config.initialValues,
organizationId: this.addOrganizationId as OrganizationId,
};
}
} }
private async canNavigateAway(action: string, cipher?: CipherView) { private async canNavigateAway(action: string, cipher?: CipherView) {