Merge pull request 'fix 1' (#3) from zelda.fix-some-i-dont-no into main

Reviewed-on: #3
This commit is contained in:
zelda 2026-04-24 17:28:53 +10:00
commit ae394b737c
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) { private _clickToConversation(id: string) {
// New Teams DOM: find via title element → closest treeitem
const titleEl = document.getElementById(`title-chat-list-item_${id}`); const titleEl = document.getElementById(`title-chat-list-item_${id}`);
const el = const el =
titleEl?.closest<HTMLElement>('[data-testid="list-item"]') ?? titleEl?.closest<HTMLElement>('[data-testid="list-item"]') ??
document.getElementById(`chat-list-item_${id}`); document.getElementById(`chat-list-item_${id}`);
if (el) { if (el) {
this.service.lastClickedRoomId = id;
el.scrollIntoView({ behavior: "smooth", block: "center" }); el.scrollIntoView({ behavior: "smooth", block: "center" });
setTimeout(() => el.click(), 200); setTimeout(() => el.click(), 200);
} }
return el?.click();
} }
private async _waitForMessagesToAppear( private async _waitForMessagesToAppear(

View File

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