getRoles and getPublicData both returns value in the first uncommited state if necessary
This commit is contained in:
parent
2f847514f0
commit
455fe53fe2
@ -1370,6 +1370,11 @@ export default class Services {
|
|||||||
const lastCommitedState = this.getLastCommitedState(process);
|
const lastCommitedState = this.getLastCommitedState(process);
|
||||||
if (lastCommitedState && lastCommitedState.roles && Object.keys(lastCommitedState.roles).length != 0) {
|
if (lastCommitedState && lastCommitedState.roles && Object.keys(lastCommitedState.roles).length != 0) {
|
||||||
return lastCommitedState!.roles;
|
return lastCommitedState!.roles;
|
||||||
|
} else if (process.states.length === 2) {
|
||||||
|
const firstState = process.states[0];
|
||||||
|
if (firstState && firstState.roles && Object.keys(firstState.roles).length != 0) {
|
||||||
|
return firstState!.roles;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1377,8 +1382,13 @@ export default class Services {
|
|||||||
|
|
||||||
public getPublicData(process: Process): Record<string, any> | null {
|
public getPublicData(process: Process): Record<string, any> | null {
|
||||||
const lastCommitedState = this.getLastCommitedState(process);
|
const lastCommitedState = this.getLastCommitedState(process);
|
||||||
if (lastCommitedState && lastCommitedState.public_data) {
|
if (lastCommitedState && lastCommitedState.public_data && Object.keys(lastCommitedState.public_data).length != 0) {
|
||||||
return lastCommitedState.public_data;
|
return lastCommitedState!.public_data;
|
||||||
|
} else if (process.states.length === 2) {
|
||||||
|
const firstState = process.states[0];
|
||||||
|
if (firstState && firstState.public_data && Object.keys(firstState.public_data).length != 0) {
|
||||||
|
return firstState!.public_data;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user