Fix getProcessesWhereTheCurrentMemberIs()
This commit is contained in:
parent
48aa9e4550
commit
4d428601b5
@ -880,7 +880,6 @@ 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
|
||||
@ -1153,11 +1152,21 @@ class ChatElement extends HTMLElement {
|
||||
const memberEmoji = await addressToEmoji(pairingProcess);
|
||||
console.log("Mon adresse:", currentMember[0], memberEmoji);
|
||||
|
||||
const processes = await this.getProcesses();
|
||||
const processes = await service.getProcesses();
|
||||
|
||||
for (const {key, value} of processes) {
|
||||
const processName = await key;
|
||||
const roles = await value.states[0].encrypted_pcd.roles;
|
||||
for (const [processId, process] of Object.entries(processes)) {
|
||||
console.log(processId);
|
||||
console.log(process);
|
||||
let roles;
|
||||
try {
|
||||
roles = await this.getRoles(process);
|
||||
if (!roles) {
|
||||
roles = await process.states[0].encrypted_pcd.roles;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to get roles for process:', processId);
|
||||
continue;
|
||||
}
|
||||
|
||||
const hasCurrentUser = Object.values(roles).some(role =>
|
||||
(role as { members: { sp_addresses: string[] }[] }).members
|
||||
@ -1165,8 +1174,8 @@ class ChatElement extends HTMLElement {
|
||||
);
|
||||
|
||||
if (hasCurrentUser) {
|
||||
this.userProcessSet.add(processName);
|
||||
console.log("Ajout du process au Set:", processName);
|
||||
this.userProcessSet.add(processId);
|
||||
console.log("Ajout du process au Set:", processId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1491,7 +1500,6 @@ class ChatElement extends HTMLElement {
|
||||
await this.loadGroupListFromAProcess(this.processId);
|
||||
} else {
|
||||
console.log("🔍 Chargement des processus par défaut");
|
||||
await this.getProcessesWhereTheCurrentMemberIs();
|
||||
const processSet = await this.getProcessesWhereTheCurrentMemberIs();
|
||||
await this.loadAllProcesses(processSet);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user