Skip to content

Commit

Permalink
Merge pull request #2430 from cloudfoundry-incubator/fix-only-assign-…
Browse files Browse the repository at this point in the history
…org-user

Fix exception thrown when only assign an org user role
  • Loading branch information
nwmac authored Jun 19, 2018
2 parents 7e1597b + 8c2895c commit 3db0e3c
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit 3db0e3c

Please sign in to comment.