Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception thrown when only assign an org user role #2430

Merged
merged 1 commit into from
Jun 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/frontend/app/store/effects/users-roles.effects.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

import {combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
import { filter, first, map, mergeMap, pairwise, withLatestFrom } from 'rxjs/operators';

import { EntityMonitor } from '../../shared/monitors/entity-monitor';
import { UsersRolesActions, UsersRolesExecuteChanges, UsersRolesClear, UsersRolesClearUpdateState } from '../actions/users-roles.actions';
import { UsersRolesActions, UsersRolesClearUpdateState, UsersRolesExecuteChanges } from '../actions/users-roles.actions';
import { AddUserPermission, ChangeUserPermission, RemoveUserPermission } from '../actions/users.actions';
import { AppState } from '../app-state';
import { entityFactory, spaceSchemaKey, organizationSchemaKey } from '../helpers/entity-factory';
import { entityFactory, organizationSchemaKey, spaceSchemaKey } from '../helpers/entity-factory';
import { selectUsersRoles } from '../selectors/users-roles.selector';
import { CfRoleChange } from '../types/users-roles.types';
import { UpdateCfAction, ICFAction } from '../types/request.types';
import { ICFAction, UpdateCfAction } from '../types/request.types';
import { OrgUserRoleNames } from '../types/user.types';
import { CfRoleChange } from '../types/users-roles.types';


@Injectable()
export class UsersRolesEffects {
Expand Down Expand Up @@ -94,10 +94,10 @@ export class UsersRolesEffects {
changes.forEach(change => {
const action = this.createAction(cfGuid, change);
this.store.dispatch(action);
// const obs = this.createActionObs(action);
observables.push(this.createActionObs(action));
});
return observableCombineLatest(...observables).pipe(
const allObservables = observables.length === 0 ? observableOf([true]) : observableCombineLatest(...observables);
return allObservables.pipe(
first()
);
}
Expand Down