Editing applyTypingFromServer & clearTypingForRoom

This commit is contained in:
2026-09-30 14:22:07 +03:30
parent c7a60c524d
commit d3986da28b
-33
View File
@@ -253,32 +253,6 @@ function applyTypingEvent(roomId: string, userId: string, name?: string) {
typingMap.value = { ...typingMap.value, [rid]: list };
}
function applyTypingFromServer(
roomId: string,
typers: Array<{ userId: string; fullName: string; chatUserId: string }>,
) {
const rid = String(roomId || '').trim();
if (!rid) return;
const now = Date.now();
const list = typers
.map((t) => ({
userId: t.chatUserId || t.userId,
name: t.fullName || undefined,
at: now,
}))
.filter((t) => t.userId && t.userId !== sessionCache?.chatUserId);
if (!list.length) {
if (typingMap.value[rid]) {
const next = { ...typingMap.value };
delete next[rid];
typingMap.value = next;
}
return;
}
startTypingSweep();
typingMap.value = { ...typingMap.value, [rid]: list };
}
function applyTypingFromServerAll(
rows: Array<{
externalRoomId: string;
@@ -309,13 +283,6 @@ function parseTypingCommand(content: string): string | null {
return t.slice(TYPING_CMD_PREFIX.length).trim() || '__someone__';
}
function clearTypingForRoom(roomId: string) {
if (!typingMap.value[roomId]) return;
const next = { ...typingMap.value };
delete next[roomId];
typingMap.value = next;
}
function clearTypingUser(roomId: string, userId: string) {
const rid = String(roomId || '').trim();
const uid = String(userId || '').trim();