Fix chat filter typescript error
This commit is contained in:
@@ -927,17 +927,16 @@ export function useOrgChat() {
|
|||||||
rememberHidden(roomId, [...hiddenSet]);
|
rememberHidden(roomId, [...hiddenSet]);
|
||||||
|
|
||||||
const myId = session.chatUserId;
|
const myId = session.chatUserId;
|
||||||
const normalized = (list
|
const normalized: ChatMessage[] = [];
|
||||||
.map((item: Record<string, unknown>) => normalizeIncoming(item, roomId))
|
for (const item of list as Record<string, unknown>[]) {
|
||||||
.filter((m): m is ChatMessage => Boolean(m) && !hiddenSet.has(m!.id)) as ChatMessage[]).map(
|
const m = normalizeIncoming(item, roomId);
|
||||||
(m) => {
|
if (!m || hiddenSet.has(m.id)) continue;
|
||||||
if (m.senderId !== myId) return m;
|
normalized.push(
|
||||||
return {
|
m.senderId === myId
|
||||||
...m,
|
? { ...m, delivery: (m.readAt ? 'read' : 'sent') as ChatDelivery }
|
||||||
delivery: (m.readAt ? 'read' : 'sent') as ChatDelivery,
|
: m,
|
||||||
};
|
);
|
||||||
},
|
}
|
||||||
);
|
|
||||||
messages.value = sortAsc(normalized);
|
messages.value = sortAsc(normalized);
|
||||||
sendRead(roomId);
|
sendRead(roomId);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user