32 lines
843 B
TypeScript
32 lines
843 B
TypeScript
/**
|
|
* Defines a message of the site-wide chat, 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;
|
|
}
|