This commit is contained in:
Admin 2026-04-24 14:28:34 +07:00
parent 2abc17f681
commit edae61970c
3 changed files with 8 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -59,17 +59,16 @@ export class ContentService {
}
private _clickToConversation(id: string) {
// New Teams DOM: find via title element → closest treeitem
const titleEl = document.getElementById(`title-chat-list-item_${id}`);
const el =
titleEl?.closest<HTMLElement>('[data-testid="list-item"]') ??
document.getElementById(`chat-list-item_${id}`);
if (el) {
this.service.lastClickedRoomId = id;
el.scrollIntoView({ behavior: "smooth", block: "center" });
setTimeout(() => el.click(), 200);
}
return el?.click();
}
private async _waitForMessagesToAppear(

View File

@ -5,6 +5,7 @@ export class TeamsChatService {
// private readonly MY_NAME = "Apactech com";
public lastMessage?: IMessage;
public initialHistories: IMessage[] = [];
public lastClickedRoomId?: string;
public elTags = {
container_scroll: '//*[@data-testid="simple-collab-rail"]',
@ -58,6 +59,11 @@ export class TeamsChatService {
?.id?.replace("chat-list-item_", "");
}
// Fallback: tracked from programmatic click
if (!roomId) {
roomId = this.lastClickedRoomId;
}
const roomName = (
document.querySelector(this.elTags.room_name) as HTMLElement
)?.innerText;