From d8f1527db003d62016b8911033cccfbc15180f6e Mon Sep 17 00:00:00 2001 From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:11:41 -0500 Subject: [PATCH 1/2] [PM-13016] Browser default match detection (#11569) * update conditional to only exit early if value is null - The UriMatchStrategy for Domain was 0 and hitting the conditional * add baseDomain test --- .../autofill-options/uri-option.component.spec.ts | 7 +++++++ .../components/autofill-options/uri-option.component.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts index fdb306ff761..d259566cc57 100644 --- a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts +++ b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts @@ -58,6 +58,13 @@ describe("UriOptionComponent", () => { expect(component["uriMatchOptions"][0].label).toBe("default"); }); + it("should update the default uri match strategy label when it is domain", () => { + component.defaultMatchDetection = UriMatchStrategy.Domain; + fixture.detectChanges(); + + expect(component["uriMatchOptions"][0].label).toBe("defaultLabel baseDomain"); + }); + it("should update the default uri match strategy label", () => { component.defaultMatchDetection = UriMatchStrategy.Exact; fixture.detectChanges(); diff --git a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts index 82870befa12..4af80ed464c 100644 --- a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts +++ b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts @@ -84,7 +84,7 @@ export class UriOptionComponent implements ControlValueAccessor { @Input({ required: true }) set defaultMatchDetection(value: UriMatchStrategySetting) { // The default selection has a value of `null` avoid showing "Default (Default)" - if (!value) { + if (value === null) { return; } From 1f330b078dd9a3dc10a4ddf33b746f29b8b597e1 Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Wed, 16 Oct 2024 09:52:45 -0400 Subject: [PATCH 2/2] Remove platformUtilService.showToast call (#11410) --- .../domain-add-edit-dialog.component.ts | 5 +++++ .../domain-verification/domain-verification.component.ts | 5 +++++ .../services/organization-domain/org-domain.service.spec.ts | 1 - .../services/organization-domain/org-domain.service.ts | 5 ----- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts index e0b76c7f5c3..7141f867882 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-add-edit-dialog/domain-add-edit-dialog.component.ts @@ -105,6 +105,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy { copyDnsTxt(): void { this.orgDomainService.copyDnsTxt(this.txtCtrl.value); + this.toastService.showToast({ + variant: "success", + title: null, + message: this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord")), + }); } // End Form methods diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts index bc68bdaaf54..703808900c9 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/domain-verification/domain-verification.component.ts @@ -101,6 +101,11 @@ export class DomainVerificationComponent implements OnInit, OnDestroy { copyDnsTxt(dnsTxt: string): void { this.orgDomainService.copyDnsTxt(dnsTxt); + this.toastService.showToast({ + variant: "success", + title: null, + message: this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord")), + }); } async verifyDomain(orgDomainId: string, domainName: string): Promise { diff --git a/libs/common/src/admin-console/services/organization-domain/org-domain.service.spec.ts b/libs/common/src/admin-console/services/organization-domain/org-domain.service.spec.ts index 6721ea3a808..21027334fb8 100644 --- a/libs/common/src/admin-console/services/organization-domain/org-domain.service.spec.ts +++ b/libs/common/src/admin-console/services/organization-domain/org-domain.service.spec.ts @@ -180,6 +180,5 @@ describe("Org Domain Service", () => { it("copyDnsTxt copies DNS TXT to clipboard and shows toast", () => { orgDomainService.copyDnsTxt("fakeTxt"); expect(jest.spyOn(platformUtilService, "copyToClipboard")).toHaveBeenCalled(); - expect(jest.spyOn(platformUtilService, "showToast")).toHaveBeenCalled(); }); }); diff --git a/libs/common/src/admin-console/services/organization-domain/org-domain.service.ts b/libs/common/src/admin-console/services/organization-domain/org-domain.service.ts index 5a5a2e4288f..ebdc098c855 100644 --- a/libs/common/src/admin-console/services/organization-domain/org-domain.service.ts +++ b/libs/common/src/admin-console/services/organization-domain/org-domain.service.ts @@ -23,11 +23,6 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction { copyDnsTxt(dnsTxt: string): void { this.platformUtilsService.copyToClipboard(dnsTxt); - this.platformUtilsService.showToast( - "success", - null, - this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord")), - ); } upsert(orgDomains: OrganizationDomainResponse[]): void {