39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/**
|
|
* The site-wide chat lets signed-in users talk live. This module types one of
|
|
* its messages, as the server sends it to the chatbox.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/**
|
|
* Returned by `GET /api/chat`, and sent by the server in `chat_message` and
|
|
* `chat_message_updated`. The client reads it through
|
|
* `deserializeChatMessage`, which turns its dates back into Dates.
|
|
*/
|
|
export interface ChatMessage {
|
|
id: string;
|
|
userId: string;
|
|
/** In Markdown, trimmed by the server. */
|
|
body: string;
|
|
createdAt: Date;
|
|
/** Absent until the first edit. */
|
|
updatedAt?: Date;
|
|
authorUsername: string;
|
|
authorAvatarMime?: string;
|
|
/**
|
|
* Kept when the message it points to is deleted, while `replyToAuthor` and
|
|
* `replyToBody` then go absent.
|
|
*/
|
|
replyToId?: string;
|
|
replyToAuthor?: string;
|
|
/** The first 300 characters of the replied-to body, in Markdown. */
|
|
replyToBody?: string;
|
|
/**
|
|
* Set when the body says `@everyone` and its author's role had
|
|
* `chat:everyone` when it was last written; absent otherwise. The client
|
|
* highlights the message for everyone and shows `@everyone` as a mention by
|
|
* it, never by the text, which anyone may type.
|
|
*/
|
|
mentionsEveryone?: boolean;
|
|
}
|