Add lookForDmProcess
This commit is contained in:
parent
a578808393
commit
b6a53ab0b3
@ -404,6 +404,33 @@ class ChatElement extends HTMLElement {
|
||||
|
||||
groupList.appendChild(memberList);
|
||||
}
|
||||
|
||||
private async lookForDmProcess(): Promise<string | null> {
|
||||
// Filter processes for the children of current process
|
||||
const service = await Services.getInstance();
|
||||
const processes = await service.getProcesses();
|
||||
|
||||
const selectedMember = this.selectedMember;
|
||||
for (const [processId, process] of Object.entries(processes)) {
|
||||
const description = await service.getDescription(processId, process);
|
||||
console.log('Process description:'description);
|
||||
if (description !== "dm") {
|
||||
continue;
|
||||
}
|
||||
const roles = await this.getRoles(process);
|
||||
if (!service.rolesContainsMember(roles, selectedMember)) {
|
||||
console.error('Member is not part of the process');
|
||||
continue;
|
||||
}
|
||||
if (!service.rolesContainsUs(roles)) {
|
||||
console.error('We\'re not part of child process');
|
||||
continue;
|
||||
}
|
||||
return processId;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private async loadMemberChat(member: string[]) {
|
||||
if (member.length === 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user