Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Add is_sending_saving to FormattedDraft.

Aadyot1b86107e0c5f4
diff --git a/web/src/drafts.ts b/web/src/drafts.ts
index 542000b9245..e843bb129aa 100644
--- a/web/src/drafts.ts
+++ b/web/src/drafts.ts
@@ -604,6 +604,7 @@ export function get_last_restorable_draft_based_on_compose_state():
export type FormattedDraft =
| {
is_stream: true;
+ is_sending_saving: boolean;
draft_id: string;
stream_name?: string | undefined;
recipient_bar_color: string;
@@ -618,6 +619,7 @@ export type FormattedDraft =
}
| {
is_stream: false;
+ is_sending_saving: boolean;
is_dm_with_self?: boolean;
draft_id: string;
recipients: string;
@@ -692,6 +694,7 @@ export function format_draft(draft: LocalStorageDraftWithId): FormattedDraft | u
return {
draft_id: draft.id,
is_stream: true,
+ is_sending_saving: draft.is_sending_saving,
stream_name,
recipient_bar_color: stream_color.get_recipient_bar_color(draft_stream_color),
stream_privacy_icon_color:
@@ -712,6 +715,7 @@ export function format_draft(draft: LocalStorageDraftWithId): FormattedDraft | u
return {
draft_id: draft.id,
is_stream: false,
+ is_sending_saving: draft.is_sending_saving,
has_recipient_data: false,
recipients: "",
raw_content: draft.content,
@@ -727,6 +731,7 @@ export function format_draft(draft: LocalStorageDraftWithId): FormattedDraft | u
return {
draft_id: draft.id,
is_stream: false,
+ is_sending_saving: draft.is_sending_saving,
is_dm_with_self,
recipients,
raw_content: draft.content,
diff --git a/web/tests/drafts.test.cjs b/web/tests/drafts.test.cjs
index c272eb6e1e3..18ddeea342a 100644
--- a/web/tests/drafts.test.cjs
+++ b/web/tests/drafts.test.cjs
@@ -555,6 +555,7 @@ test("format_drafts", ({override, mock_template}) => {
time_stamp: "7:55 AM",
invite_only: stream_1.invite_only,
is_web_public: stream_1.is_web_public,
+ is_sending_saving: false,
},
{
draft_id: "id2",
@@ -564,6 +565,7 @@ test("format_drafts", ({override, mock_template}) => {
recipients: "Aaron",
raw_content: "Test direct message",
time_stamp: "Jan 30",
+ is_sending_saving: false,
},
{
draft_id: "id5",
@@ -573,6 +575,7 @@ test("format_drafts", ({override, mock_template}) => {
has_recipient_data: true,
raw_content: "Test direct message 3",
time_stamp: "Jan 29",
+ is_sending_saving: false,
},
{
draft_id: "id4",
@@ -582,6 +585,7 @@ test("format_drafts", ({override, mock_template}) => {
has_recipient_data: true,
raw_content: "Test direct message 2",
time_stamp: "Jan 26",
+ is_sending_saving: false,
},
{
draft_id: "id3",
@@ -596,6 +600,7 @@ test("format_drafts", ({override, mock_template}) => {
time_stamp: "Jan 21",
invite_only: stream_2.invite_only,
is_web_public: stream_2.is_web_public,
+ is_sending_saving: false,
},
{
draft_id: "id6",
@@ -610,6 +615,7 @@ test("format_drafts", ({override, mock_template}) => {
time_stamp: "Jan 20",
invite_only: stream_2.invite_only,
is_web_public: stream_2.is_web_public,
+ is_sending_saving: false,
},
{
draft_id: "id7",
@@ -618,6 +624,7 @@ test("format_drafts", ({override, mock_template}) => {
recipients: "",
raw_content: "Test direct message 4",
time_stamp: "Jan 19",
+ is_sending_saving: false,
},
];
@@ -724,6 +731,7 @@ test("filter_drafts", ({override, mock_template}) => {
recipients: "Aaron",
raw_content: "Test direct message",
time_stamp: "Jan 30",
+ is_sending_saving: false,
},
{
draft_id: "id5",
@@ -733,6 +741,7 @@ test("filter_drafts", ({override, mock_template}) => {
recipients: "Aaron",
raw_content: "Test direct message 3",
time_stamp: "Jan 29",
+ is_sending_saving: false,
},
{
draft_id: "id4",
@@ -742,6 +751,7 @@ test("filter_drafts", ({override, mock_template}) => {
recipients: "Aaron",
raw_content: "Test direct message 2",
time_stamp: "Jan 26",
+ is_sending_saving: false,
},
];
@@ -759,6 +769,7 @@ test("filter_drafts", ({override, mock_template}) => {
time_stamp: "7:55 AM",
invite_only: stream_1.invite_only,
is_web_public: stream_1.is_web_public,
+ is_sending_saving: false,
},
{
draft_id: "id3",
@@ -773,6 +784,7 @@ test("filter_drafts", ({override, mock_template}) => {
time_stamp: "Jan 21",
invite_only: stream_2.invite_only,
is_web_public: stream_2.is_web_public,
+ is_sending_saving: false,
},
];