mirror of
https://github.com/bitwarden/browser
synced 2025-12-27 05:33:59 +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:
@@ -35,9 +35,15 @@
|
||||
(cipherSaved)="savedCipher($event)"
|
||||
[beforeSubmit]="onSubmit"
|
||||
[submitBtn]="footer?.submitBtn"
|
||||
(formStatusChange$)="formStatusChanged($event)"
|
||||
>
|
||||
<bit-item slot="attachment-button">
|
||||
<button bit-item-content type="button" (click)="openAttachmentsDialog()">
|
||||
<button
|
||||
bit-item-content
|
||||
type="button"
|
||||
(click)="openAttachmentsDialog()"
|
||||
[disabled]="formDisabled"
|
||||
>
|
||||
<p class="tw-m-0">
|
||||
{{ "attachments" | i18n }}
|
||||
<span
|
||||
|
||||
@@ -163,6 +163,9 @@ export class VaultV2Component<C extends CipherViewLike>
|
||||
config: CipherFormConfig | null = null;
|
||||
isSubmitting = false;
|
||||
|
||||
/** Tracks the disabled status of the edit cipher form */
|
||||
protected formDisabled: boolean = false;
|
||||
|
||||
private organizations$: Observable<Organization[]> = this.accountService.activeAccount$.pipe(
|
||||
map((a) => a?.id),
|
||||
switchMap((id) => this.organizationService.organizations$(id)),
|
||||
@@ -447,6 +450,10 @@ export class VaultV2Component<C extends CipherViewLike>
|
||||
);
|
||||
}
|
||||
|
||||
formStatusChanged(status: "disabled" | "enabled") {
|
||||
this.formDisabled = status === "disabled";
|
||||
}
|
||||
|
||||
async openAttachmentsDialog() {
|
||||
if (!this.userHasPremiumAccess) {
|
||||
await this.premiumUpgradePromptService.promptForPremium();
|
||||
|
||||
Reference in New Issue
Block a user