1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

[PM-24304][PM-24305] - [Defect] Some fields are not disabled when editing an item from My Vault (#15982)

* disable all remaining form fields for editing personally owned My Items

* fix failing tests

* ensure collection field is also properly disabled

* clean up logic

* fix failing test

* fix test

* refactor variable to avoid using `is` prefix

* directly reference parent form for status rather than subscribe to it

* refactor subscription for form status changes

* use observable as an Output

* disable attachment button on desktop vault when the form

* disable custom field components when custom fields already exist and parent form is disabled

* disable attachments button in the browser when the edit form is disabled

* grab icon button instance for disabled state

---------

Co-authored-by: Nick Krantz <nick@livefront.com>
This commit is contained in:
Jordan Aasen
2025-08-25 15:48:00 -07:00
committed by GitHub
parent e10d13faa8
commit 9ed69ef4b8
22 changed files with 224 additions and 36 deletions

View File

@@ -72,6 +72,10 @@ export class AutofillOptionsComponent implements OnInit {
return this.autofillOptionsForm.controls.uris.controls;
}
protected get isPartialEdit() {
return this.cipherFormContainer.config.mode === "partial-edit";
}
protected defaultMatchDetection$ = this.domainSettingsService.defaultUriMatchStrategy$.pipe(
// The default match detection should only be shown when used on the browser
filter(() => this.platformUtilsService.getClientType() == ClientType.Browser),
@@ -102,7 +106,7 @@ export class AutofillOptionsComponent implements OnInit {
this.autofillOptionsForm.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
this.cipherFormContainer.patchCipher((cipher) => {
cipher.login.uris = value.uris.map((uri: UriField) =>
cipher.login.uris = value.uris?.map((uri: UriField) =>
Object.assign(new LoginUriView(), {
uri: uri.uri,
match: uri.matchDetection,
@@ -126,6 +130,15 @@ export class AutofillOptionsComponent implements OnInit {
.subscribe(() => {
this.uriOptions?.last?.focusInput();
});
this.cipherFormContainer.formStatusChange$.pipe(takeUntilDestroyed()).subscribe((status) => {
// Disable adding new URIs when the cipher form is disabled
if (status === "disabled") {
this.autofillOptionsForm.disable();
} else if (!this.isPartialEdit) {
this.autofillOptionsForm.enable();
}
});
}
ngOnInit() {
@@ -136,7 +149,7 @@ export class AutofillOptionsComponent implements OnInit {
this.initNewCipher();
}
if (this.cipherFormContainer.config.mode === "partial-edit") {
if (this.isPartialEdit) {
this.autofillOptionsForm.disable();
}
}