Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/persistence of empty comment in create or update account dialog (#7512)

Thomas Kaulb37654c7c668
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5a856ca09b..115d25a92e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed the handling of the _Exclude from Analysis_ tag in the activities table
+- Fixed the persistence of an empty comment in the create or update account dialog
- Resolved a validation error caused by empty strings in the asset profile details dialog of the admin control panel
## 3.39.0 - 2026-08-01
diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
index 8b0536ebfa..2157ea5d34 100644
--- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
+++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
@@ -1,6 +1,7 @@
import { UserService } from '@ghostfolio/client/services/user/user.service';
import { TAG_ID_EXCLUDE_FROM_ANALYSIS } from '@ghostfolio/common/config';
import { CreateAccountDto, UpdateAccountDto } from '@ghostfolio/common/dtos';
+import { getStringOrNull } from '@ghostfolio/common/helper';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { validateObjectForForm } from '@ghostfolio/common/utils';
import { GfCurrencySelectorComponent } from '@ghostfolio/ui/currency-selector';
@@ -198,7 +199,7 @@ export class GfCreateOrUpdateAccountDialogComponent {
protected async onSubmit() {
const account: CreateAccountDto | UpdateAccountDto = {
balance: this.accountForm.get('balance')?.value,
- comment: this.accountForm.get('comment')?.value ?? null,
+ comment: getStringOrNull(this.accountForm.get('comment')?.value),
currency: this.accountForm.get('currency')?.value,
id: this.accountForm.get('accountId')?.value,
name: this.accountForm.get('name')?.value,
diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
index 632db1cd41..3b80d28251 100644
--- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
+++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
@@ -1,7 +1,10 @@
import { UserService } from '@ghostfolio/client/services/user/user.service';
import { ASSET_CLASS_MAPPING, DEFAULT_LOCALE } from '@ghostfolio/common/config';
import { CreateOrderDto, UpdateOrderDto } from '@ghostfolio/common/dtos';
-import { getDateFormatString } from '@ghostfolio/common/helper';
+import {
+ getDateFormatString,
+ getStringOrNull
+} from '@ghostfolio/common/helper';
import {
AssetClassSelectorOption,
LookupItem
@@ -471,7 +474,7 @@ export class GfCreateOrUpdateActivityDialogComponent {
accountId: this.activityForm.get('accountId')?.value,
assetClass: this.activityForm.get('assetClass')?.value,
assetSubClass: this.activityForm.get('assetSubClass')?.value,
- comment: this.activityForm.get('comment')?.value ?? null,
+ comment: getStringOrNull(this.activityForm.get('comment')?.value),
currency: this.activityForm.get('currency')?.value,
customCurrency: this.activityForm.get('currencyOfUnitPrice')?.value,
dataSource: ['FEE', 'INTEREST', 'LIABILITY', 'VALUABLE'].includes(
diff --git a/libs/common/src/lib/dtos/create-account.dto.ts b/libs/common/src/lib/dtos/create-account.dto.ts
index e4a0c64fe8..cae8293ee8 100644
--- a/libs/common/src/lib/dtos/create-account.dto.ts
+++ b/libs/common/src/lib/dtos/create-account.dto.ts
@@ -20,7 +20,7 @@ export class CreateAccountDto {
@Transform(({ value }: TransformFnParams) =>
isString(value) ? value.trim() : value
)
- comment?: string;
+ comment?: string | null;
@IsCurrencyCode()
currency: string;
diff --git a/libs/common/src/lib/dtos/create-order.dto.ts b/libs/common/src/lib/dtos/create-order.dto.ts
index 36365b7be0..c70b66b025 100644
--- a/libs/common/src/lib/dtos/create-order.dto.ts
+++ b/libs/common/src/lib/dtos/create-order.dto.ts
@@ -35,7 +35,7 @@ export class CreateOrderDto {
@Transform(({ value }: TransformFnParams) =>
isString(value) ? value.trim() : value
)
- comment?: string;
+ comment?: string | null;
@IsCurrencyCode()
currency: string;
diff --git a/libs/common/src/lib/dtos/update-account.dto.ts b/libs/common/src/lib/dtos/update-account.dto.ts
index a6a3e6ac67..d8bfc7b8d9 100644
--- a/libs/common/src/lib/dtos/update-account.dto.ts
+++ b/libs/common/src/lib/dtos/update-account.dto.ts
@@ -20,7 +20,7 @@ export class UpdateAccountDto {
@Transform(({ value }: TransformFnParams) =>
isString(value) ? value.trim() : value
)
- comment?: string;
+ comment?: string | null;
@IsCurrencyCode()
currency: string;
diff --git a/libs/common/src/lib/dtos/update-order.dto.ts b/libs/common/src/lib/dtos/update-order.dto.ts
index 991479bc8b..d8fdbe66b6 100644
--- a/libs/common/src/lib/dtos/update-order.dto.ts
+++ b/libs/common/src/lib/dtos/update-order.dto.ts
@@ -34,7 +34,7 @@ export class UpdateOrderDto {
@Transform(({ value }: TransformFnParams) =>
isString(value) ? value.trim() : value
)
- comment?: string;
+ comment?: string | null;
@IsCurrencyCode()
currency: string;