/** * Comments let users discuss a dump under it, in threads. This module types * them, with the bodies that post and edit them. The dump page's * `CommentThread` renders them as a tree, by `parentId`. * * @module */ /** * Returned by the comment routes, and sent in the `comment_created` and * `comment_updated` WebSocket messages. It carries its author's name and * avatar, so the thread needn't look them up. */ export interface Comment { id: string; dumpId: string; userId: string; /** It is undefined on a top-level comment. */ parentId?: string; /** The Markdown text. Deleting the comment empties it. */ body: string; createdAt: Date; updatedAt?: Date; /** * A deleted comment stays in the thread, emptied, so its replies keep their * place. */ deleted: boolean; likeCount: number; authorUsername: string; authorAvatarMime?: string; } /** * Passed to `POST /api/dumps/:dumpId/comments` by `CommentThread`, and by * `CommentNode` for a reply. The body must not be blank. */ export interface CreateCommentRequest { body: string; parentId?: string; } /** Passed to `PATCH /api/comments/:commentId` by `CommentNode`. */ export interface UpdateCommentRequest { body: string; }