Browse Source

Merge branch 'main' into feature/improve-validation-of-currency-management

pull/2761/head
Thomas Kaul 2 years ago
committed by GitHub
parent
commit
c99347d073
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 7
      apps/api/src/app/account-balance/account-balance.controller.ts
  3. 14
      apps/api/src/helper/object.helper.ts
  4. 4
      apps/client/src/styles/theme.scss

5
CHANGELOG.md

@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Set the select column of the lazy-loaded activities table to stick at the end (experimental)
- Improved the validation of the currency management in the admin control panel
- Improved the performance of the value redaction interceptor for the impersonation mode by eliminating `cloneDeep`
### Fixed
- Reset the letter spacing in buttons
## 2.31.0 - 2023-12-16

7
apps/api/src/app/account-balance/account-balance.controller.ts

@ -1,3 +1,4 @@
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import type { RequestWithUser } from '@ghostfolio/common/types';
import {
Controller,
@ -8,11 +9,11 @@ import {
UseGuards
} from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { AccountBalanceService } from './account-balance.service';
import { AuthGuard } from '@nestjs/passport';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { AccountBalance } from '@prisma/client';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { AccountBalanceService } from './account-balance.service';
@Controller('account-balance')
export class AccountBalanceController {

14
apps/api/src/helper/object.helper.ts

@ -32,9 +32,11 @@ export function nullifyValuesInObjects<T>(aObjects: T[], keys: string[]): T[] {
}
export function redactAttributes({
isFirstRun = true,
object,
options
}: {
isFirstRun?: boolean;
object: any;
options: { attribute: string; valueMap: { [key: string]: any } }[];
}): any {
@ -42,7 +44,10 @@ export function redactAttributes({
return object;
}
const redactedObject = cloneDeep(object);
// Create deep clone
const redactedObject = isFirstRun
? JSON.parse(JSON.stringify(object))
: object;
for (const option of options) {
if (redactedObject.hasOwnProperty(option.attribute)) {
@ -59,7 +64,11 @@ export function redactAttributes({
if (isArray(redactedObject[property])) {
redactedObject[property] = redactedObject[property].map(
(currentObject) => {
return redactAttributes({ options, object: currentObject });
return redactAttributes({
options,
isFirstRun: false,
object: currentObject
});
}
);
} else if (
@ -69,6 +78,7 @@ export function redactAttributes({
// Recursively call the function on the nested object
redactedObject[property] = redactAttributes({
options,
isFirstRun: false,
object: redactedObject[property]
});
}

4
apps/client/src/styles/theme.scss

@ -111,5 +111,7 @@ $gf-theme-dark: mat.define-dark-theme(
--gf-theme-secondary-500: #3686cf;
--gf-theme-secondary-500-rgb: 78, 208, 94;
--mdc-typography-button-letter-spacing: normal;
--mdc-filled-button-label-text-tracking: normal;
--mdc-outlined-button-label-text-tracking: normal;
--mdc-text-button-label-text-tracking: normal;
}

Loading…
Cancel
Save