Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose_banner: Display time for messages with < 5 mins scheduled time.
Akarsh Jaind8d70d9e4384
diff --git a/web/src/scheduled_messages.js b/web/src/scheduled_messages.jsindex 0af9292abc6..017e61363a3 100644--- a/web/src/scheduled_messages.js+++ b/web/src/scheduled_messages.js@@ -33,21 +33,6 @@ function compute_send_times(now = new Date()) {return send_times;}-export function is_send_later_timestamp_missing_or_expired(- timestamp_in_seconds,- current_time_in_seconds,-) {- if (!timestamp_in_seconds) {- return true;- }- // Determine if the selected timestamp is less than the minimum- // scheduled message delay- if (timestamp_in_seconds - current_time_in_seconds < MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS) {- return true;- }- return false;-}-export function add_scheduled_messages(scheduled_messages) {for (const scheduled_message of scheduled_messages) {scheduled_messages_data[scheduled_message.scheduled_message_id] = scheduled_message;@@ -194,8 +179,7 @@ export function get_selected_send_later_timestamp() {}export function get_formatted_selected_send_later_time() {- const current_time = Date.now() / 1000; // seconds, like selected_send_later_timestamp- if (is_send_later_timestamp_missing_or_expired(selected_send_later_timestamp, current_time)) {+ if (!selected_send_later_timestamp) {return undefined;}return timerender.get_full_datetime(new Date(selected_send_later_timestamp * 1000), "time");diff --git a/web/tests/scheduled_messages.test.js b/web/tests/scheduled_messages.test.jsindex 0410edda8e8..d1249ad18f2 100644--- a/web/tests/scheduled_messages.test.js+++ b/web/tests/scheduled_messages.test.js@@ -142,25 +142,6 @@ run_test("scheduled_modal_opts", () => {}});-run_test("missing_or_expired_timestamps", () => {- let now_in_seconds = new Date("2023-05-03T08:54:00").getTime();- // The today at 9am option is not expired as of 8:54am (false)- assert.ok(- !scheduled_messages.is_send_later_timestamp_missing_or_expired(- per_day_stamps["2023-05-03"].today_nine_am / 1000,- now_in_seconds / 1000,- ),- );- // The today at 9am option is expired as of 8:57am (true)- now_in_seconds = new Date("2023-05-03T08:57:00").getTime();- assert.ok(- scheduled_messages.is_send_later_timestamp_missing_or_expired(- per_day_stamps["2023-05-03"].today_nine_am / 1000,- now_in_seconds / 1000,- ),- );-});-run_test("should_update_send_later_options", () => {// We should rerender at midnightconst start_of_the_day = new Date();