typing_status: Add an extra notification_event_type to Recipients.

This is a preparatory commit. It adds an extra notification_event_type
to the Recipient type. This can be used to differentiate between
typing notifications and message edit typing notifications since
they send different events.
This commit is contained in:
roanster007 2024-02-11 22:55:56 +05:30 committed by Tim Abbott
parent 6ab63874f2
commit 07ccd29a9b
2 changed files with 4 additions and 0 deletions

View File

@ -8,10 +8,12 @@ type StreamTopic = {
export type Recipient = export type Recipient =
| { | {
message_type: "direct"; message_type: "direct";
notification_event_type: "typing";
ids: number[]; ids: number[];
} }
| (StreamTopic & { | (StreamTopic & {
message_type: "stream"; message_type: "stream";
notification_event_type: "typing";
}); });
type TypingStatusWorker = { type TypingStatusWorker = {
get_current_time: () => number; get_current_time: () => number;

View File

@ -113,6 +113,7 @@ export function get_recipient(): Recipient | null {
if (message_type === "private") { if (message_type === "private") {
return { return {
message_type: "direct", message_type: "direct",
notification_event_type: "typing",
ids: get_user_ids_array()!, ids: get_user_ids_array()!,
}; };
} }
@ -122,6 +123,7 @@ export function get_recipient(): Recipient | null {
const topic = compose_state.topic(); const topic = compose_state.topic();
return { return {
message_type: "stream", message_type: "stream",
notification_event_type: "typing",
stream_id, stream_id,
topic, topic,
}; };