fix: chat UI
This commit is contained in:
+19
@@ -251,6 +251,10 @@ export const chat = {
|
||||
* Opens (or returns) the DM with a profile. Idempotent, and keyed by handle
|
||||
* because that is what a profile page has.
|
||||
*/
|
||||
/** Threads waiting on the caller. Muted ones are excluded — see the BFF. */
|
||||
unreadCount: () =>
|
||||
call<{ count: number }>("/chat/unread").then((r) => r.count),
|
||||
|
||||
openDM: (handle: string) =>
|
||||
call<{ id: string; kind: ConversationKind }>("/chat/conversations/dm", {
|
||||
method: "POST",
|
||||
@@ -589,6 +593,21 @@ export function followSummary(
|
||||
}
|
||||
|
||||
/** Resolves a sender id to a display name using a thread's participants. */
|
||||
/**
|
||||
* The participant who sent a message, or undefined for Kautilya, a system
|
||||
* message, or someone who has since been removed.
|
||||
*
|
||||
* Groups need this rather than the conversation's `peer`: `peer` is only set
|
||||
* on DMs, so a group has no single counterpart to read an avatar from.
|
||||
*/
|
||||
export function senderPeer(
|
||||
senderId: string | null | undefined,
|
||||
participants: ChatPeer[],
|
||||
): ChatPeer | undefined {
|
||||
if (!senderId) return undefined;
|
||||
return participants.find((p) => p.id === senderId);
|
||||
}
|
||||
|
||||
export function senderName(
|
||||
senderId: string | null | undefined,
|
||||
participants: ChatPeer[],
|
||||
|
||||
Reference in New Issue
Block a user