Skip to content

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

Bugfix/sustainable retirement income for redacted values (#7976)

Thomas Kaul11749d0c9adf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be16617266..a31f5f7b3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the allocation column of the top holdings of ETFs on the allocations page after a change of the user settings
- Fixed the value column of the top holdings of ETFs on the allocations page in the _Presenter View_
- Fixed the projected sustainable retirement income on the _FIRE_ page for a projected total amount of zero (experimental)
+- Fixed the sustainable retirement income on the _FIRE_ page for redacted values
- Fixed the emergency fund in the portfolio summary for redacted values
- Fixed the redaction of `valueInBaseCurrency` in the holdings of ETFs in a restricted view
diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
index 33b877d42f..a6a6c7dfd8 100644
--- a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
+++ b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
@@ -8,6 +8,7 @@ import {
User
} from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
+import { hasScope, scopes } from '@ghostfolio/common/scopes';
import { GfFireCalculatorComponent } from '@ghostfolio/ui/fire-calculator';
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator';
import { DataService } from '@ghostfolio/ui/services';
@@ -53,6 +54,7 @@ export class GfFirePageComponent implements OnInit {
protected fireWealth: FireWealth;
protected hasImpersonationId: boolean;
+ protected hasPermissionToShowValues: boolean;
protected hasPermissionToUpdateUserSettings: boolean;
protected isLoading = false;
protected retirementDate: Date;
@@ -142,6 +144,10 @@ export class GfFirePageComponent implements OnInit {
if (state?.user) {
this.user = state.user;
+ this.hasPermissionToShowValues =
+ hasScope(this.user.scopes, scopes.portfolioReadValues) &&
+ !this.user.settings.isRestrictedView;
+
this.hasPermissionToUpdateUserSettings =
this.user.subscription?.type === SubscriptionType.Basic
? false
diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.html b/apps/client/src/app/pages/portfolio/fire/fire-page.html
index 7315f10cb0..3f12ddc126 100644
--- a/apps/client/src/app/pages/portfolio/fire/fire-page.html
+++ b/apps/client/src/app/pages/portfolio/fire/fire-page.html
@@ -73,7 +73,11 @@
[isCurrency]="true"
[locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency"
- [value]="withdrawalRatePerYear?.toNumber()"
+ [value]="
+ hasPermissionToShowValues
+ ? withdrawalRatePerYear?.toNumber()
+ : null
+ "
/>
per year</span
>
@@ -84,7 +88,11 @@
[isCurrency]="true"
[locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency"
- [value]="withdrawalRatePerMonth?.toNumber()"
+ [value]="
+ hasPermissionToShowValues
+ ? withdrawalRatePerMonth?.toNumber()
+ : null
+ "
/>
per month</span
>, based on your total assets of
@@ -94,7 +102,11 @@
[isCurrency]="true"
[locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency"
- [value]="fireWealth?.today.valueInBaseCurrency"
+ [value]="
+ hasPermissionToShowValues
+ ? fireWealth?.today.valueInBaseCurrency
+ : null
+ "
/></span>
and a safe withdrawal rate (SWR) of</ng-container
>
@@ -137,7 +149,11 @@
[isCurrency]="true"
[locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency"
- [value]="withdrawalRatePerYearProjected?.toNumber()"
+ [value]="
+ hasPermissionToShowValues
+ ? withdrawalRatePerYearProjected?.toNumber()
+ : null
+ "
/>
per year</span
>
@@ -148,7 +164,11 @@
[isCurrency]="true"
[locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency"
- [value]="withdrawalRatePerMonthProjected?.toNumber()"
+ [value]="
+ hasPermissionToShowValues
+ ? withdrawalRatePerMonthProjected?.toNumber()
+ : null
+ "
/>
per month</span
>, assuming a