Fix getRoles
This commit is contained in:
parent
f50bdafc80
commit
a578808393
@ -641,6 +641,7 @@ class ChatElement extends HTMLElement {
|
||||
const service = await Services.getInstance();
|
||||
// Get the `commited_in` value of the last state and remove it from the array
|
||||
const currentCommitedIn = process.states.pop()?.commited_in;
|
||||
console.log('Current CommitedIn (roles):' currentCommitedIn);
|
||||
|
||||
if (currentCommitedIn === undefined) {
|
||||
return null; // No states available
|
||||
@ -650,6 +651,7 @@ class ChatElement extends HTMLElement {
|
||||
let lastDifferentState = process.states.findLast(
|
||||
state => state.commited_in !== currentCommitedIn
|
||||
);
|
||||
|
||||
|
||||
if (!lastDifferentState) {
|
||||
// It means that we only have one state that is not commited yet, that can happen with process we just created
|
||||
@ -657,6 +659,12 @@ class ChatElement extends HTMLElement {
|
||||
lastDifferentState = process.states.pop();
|
||||
}
|
||||
|
||||
if (!lastDifferentState.pcd_commitment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log('lastDifferentState (roles):'lastDifferentState);
|
||||
|
||||
// Take the roles out of the state
|
||||
const roles = lastDifferentState!.pcd_commitment['roles'];
|
||||
if (roles) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user