message: Make draft_id not optional in LocalMessage.

This commit is contained in:
Evy Kassirer
2025-09-15 10:54:50 -07:00
committed by Tim Abbott
parent a175a82590
commit f186a0edbb
2 changed files with 1 additions and 7 deletions

View File

@@ -99,7 +99,7 @@ export type RawLocalMessage = MessageRequestObject & {
id: number; id: number;
topic_links: TopicLink[]; topic_links: TopicLink[];
reactions: MessageReaction[]; reactions: MessageReaction[];
draft_id: string | undefined; draft_id: string;
} & (StreamMessageObject | PrivateMessageObject); } & (StreamMessageObject | PrivateMessageObject);
export type PostMessageAPIData = z.output<typeof send_message_api_response_schema>; export type PostMessageAPIData = z.output<typeof send_message_api_response_schema>;

View File

@@ -155,8 +155,6 @@ export function process_new_message(opts: NewMessage): ProcessedMessage {
// When we have a new format for `display_recipient` in message objects in // When we have a new format for `display_recipient` in message objects in
// the API itself, we'll naturally clean this up. // the API itself, we'll naturally clean this up.
assert(rest.display_recipient !== undefined); assert(rest.display_recipient !== undefined);
// TODO: Make `draft_id` not optional in `LocalMessage` (upcoming commit)
assert(rest.draft_id !== undefined);
const local_message: LocalMessage = { const local_message: LocalMessage = {
...rest, ...rest,
sent_by_me, sent_by_me,
@@ -172,7 +170,6 @@ export function process_new_message(opts: NewMessage): ProcessedMessage {
display_reply_to: undefined, display_reply_to: undefined,
display_recipient: rest.display_recipient, display_recipient: rest.display_recipient,
client: electron_bridge === undefined ? "website" : "ZulipElectron", client: electron_bridge === undefined ? "website" : "ZulipElectron",
draft_id: rest.draft_id,
submessages: [], submessages: [],
}; };
message_user_ids.add_user_id(local_message.sender_id); message_user_ids.add_user_id(local_message.sender_id);
@@ -209,8 +206,6 @@ export function process_new_message(opts: NewMessage): ProcessedMessage {
// When we have a new format for `display_recipient` in message objects in // When we have a new format for `display_recipient` in message objects in
// the API itself, we'll naturally clean this up. // the API itself, we'll naturally clean this up.
assert(rest.display_recipient !== undefined); assert(rest.display_recipient !== undefined);
// TODO: Make `draft_id` not optional in `LocalMessage` (upcoming commit)
assert(rest.draft_id !== undefined);
const local_message: LocalMessage = { const local_message: LocalMessage = {
...rest, ...rest,
sent_by_me, sent_by_me,
@@ -225,7 +220,6 @@ export function process_new_message(opts: NewMessage): ProcessedMessage {
to_user_ids, to_user_ids,
clean_reactions, clean_reactions,
display_recipient: rest.display_recipient, display_recipient: rest.display_recipient,
draft_id: rest.draft_id,
submessages: [], submessages: [],
client: electron_bridge === undefined ? "website" : "ZulipElectron", client: electron_bridge === undefined ? "website" : "ZulipElectron",
}; };