Various fix in chat
This commit is contained in:
parent
722e08ea82
commit
090bdbedaa
@ -552,7 +552,7 @@ class ChatElement extends HTMLElement {
|
|||||||
const process = await service.getProcess(processId);
|
const process = await service.getProcess(processId);
|
||||||
console.log(process);
|
console.log(process);
|
||||||
const state = process.states[0]; // We assume that description never change and that we are part of the process from the beginning
|
const state = process.states[0]; // We assume that description never change and that we are part of the process from the beginning
|
||||||
const description = await service.decryptAttribute(state, 'description');
|
const description = await service.decryptAttribute(processId, state, 'description');
|
||||||
console.log(description);
|
console.log(description);
|
||||||
if (!description || description !== "dm") {
|
if (!description || description !== "dm") {
|
||||||
continue;
|
continue;
|
||||||
@ -583,7 +583,7 @@ class ChatElement extends HTMLElement {
|
|||||||
for (const processId of processes) {
|
for (const processId of processes) {
|
||||||
const process = await service.getProcess(processId);
|
const process = await service.getProcess(processId);
|
||||||
const state = process.states[0];
|
const state = process.states[0];
|
||||||
const description = await service.decryptAttribute(state, 'description');
|
const description = await service.decryptAttribute(processId, state, 'description');
|
||||||
if (!description || description !== "dm") {
|
if (!description || description !== "dm") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -704,25 +704,25 @@ class ChatElement extends HTMLElement {
|
|||||||
// Récupérer les messages depuis les états du processus
|
// Récupérer les messages depuis les états du processus
|
||||||
const allMessages: any[] = [];
|
const allMessages: any[] = [];
|
||||||
|
|
||||||
const dmProcess = await service.getProcess(dmProcessId);
|
const dmProcess = await service.getProcess(this.selectedChatProcessId);
|
||||||
|
|
||||||
console.log(dmProcess);
|
console.log(dmProcess);
|
||||||
|
|
||||||
if (dmProcess?.states) {
|
if (dmProcess?.states) {
|
||||||
for (const state of dmProcess.states) {
|
for (const state of dmProcess.states) {
|
||||||
const pcd_commitment = state.pcd_commitment;
|
if (state.state_id === '') { continue; }
|
||||||
const message = await service.decryptAttribute(state, 'message');
|
const message = await service.decryptAttribute(this.selectedChatProcessId, state, 'message');
|
||||||
if (message === "" || message === undefined || message === null) {
|
if (message === "" || message === undefined || message === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
console.log('message', message);
|
|
||||||
allMessages.push(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
console.log('message', message);
|
||||||
|
allMessages.push(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
allMessages.sort((a, b) => a.metadata.createdAt - b.metadata.createdAt);
|
|
||||||
if (allMessages.length > 0) {
|
if (allMessages.length > 0) {
|
||||||
console.log('Messages found:', allMessages);
|
console.log('Messages found:', allMessages);
|
||||||
|
allMessages.sort((a, b) => a.metadata.createdAt - b.metadata.createdAt);
|
||||||
for (const message of allMessages) {
|
for (const message of allMessages) {
|
||||||
const messageElement = document.createElement('div');
|
const messageElement = document.createElement('div');
|
||||||
messageElement.className = 'message-container';
|
messageElement.className = 'message-container';
|
||||||
@ -837,8 +837,8 @@ class ChatElement extends HTMLElement {
|
|||||||
|
|
||||||
if (dmProcess?.states) {
|
if (dmProcess?.states) {
|
||||||
for (const state of dmProcess.states) {
|
for (const state of dmProcess.states) {
|
||||||
const pcd_commitment = state.pcd_commitment;
|
if (!state.state_id) { continue; }
|
||||||
const message = await service.decryptAttribute(state, 'message');
|
const message = await service.decryptAttribute(dmProcessId, state, 'message');
|
||||||
if (message === "" || message === undefined || message === null) {
|
if (message === "" || message === undefined || message === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1143,7 +1143,8 @@ class ChatElement extends HTMLElement {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const processName = service.getProcessName(process);
|
const publicData = service.getPublicData(process);
|
||||||
|
const processName = publicData['processName'];
|
||||||
const emoji = await addressToEmoji(processId);
|
const emoji = await addressToEmoji(processId);
|
||||||
|
|
||||||
let displayName;
|
let displayName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user