Bugfix/force reload accounts of user after change (#994)
* Force reload of accounts after change * Update changelog
This commit is contained in:
parent
74fe90906a
commit
2abe399ebd
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Reloaded the accounts of a user after creating, editing or deleting one
|
||||
- Excluded empty items in the activities filter
|
||||
|
||||
## 1.156.0 - 05.06.2022
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
} from '@ghostfolio/common/permissions';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Prisma, Role, User, ViewMode } from '@prisma/client';
|
||||
import { sortBy } from 'lodash';
|
||||
|
||||
import { UserSettingsParams } from './interfaces/user-settings-params.interface';
|
||||
import { UserSettings } from './interfaces/user-settings.interface';
|
||||
@ -185,6 +186,9 @@ export class UserService {
|
||||
}
|
||||
}
|
||||
|
||||
user.Account = sortBy(user.Account, (account) => {
|
||||
return account.name;
|
||||
});
|
||||
user.permissions = currentPermissions.sort();
|
||||
|
||||
return user;
|
||||
|
@ -133,6 +133,11 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.userService
|
||||
.get(true)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe();
|
||||
|
||||
this.fetchAccounts();
|
||||
}
|
||||
});
|
||||
@ -179,6 +184,11 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.userService
|
||||
.get(true)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe();
|
||||
|
||||
this.fetchAccounts();
|
||||
}
|
||||
});
|
||||
@ -220,6 +230,11 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.userService
|
||||
.get(true)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe();
|
||||
|
||||
this.fetchAccounts();
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
export enum UserStoreActions {
|
||||
GetUser = 'GET_USER',
|
||||
Initialize = 'INITIALIZE',
|
||||
RemoveUser = 'REMOVE_USER'
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ export class UserService extends ObservableStore<UserStoreState> {
|
||||
public constructor(private http: HttpClient) {
|
||||
super({ trackStateHistory: true });
|
||||
|
||||
this.setState({ user: undefined }, 'INIT_STATE');
|
||||
this.setState({ user: undefined }, UserStoreActions.Initialize);
|
||||
}
|
||||
|
||||
public get() {
|
||||
public get(force = false) {
|
||||
const state = this.getState();
|
||||
|
||||
if (state?.user) {
|
||||
if (state?.user && force !== true) {
|
||||
// Get from cache
|
||||
return of(state.user);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user