compose: Add notice to confirmation banner.

This commit adds a note to the confirmation banner when a message is
scheduled for less than the MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS.
The approach here is to use the flatpickr's onClose method.
onClose callback is triggered when the user selects a date. We compare
the selected date with the minDate set in the flatpickr and based on the
time set by the user we update the flag
minimum_scheduled_message_delay_minutes_note.

Fixes: #28503.

Co-authored-by: ankur prabhu <ankurprabhu0531@gmail.com>
This commit is contained in:
Maneesh Shukla
2025-01-31 02:23:52 +05:30
committed by Tim Abbott
parent ee51474a05
commit be8093197e
4 changed files with 31 additions and 3 deletions

View File

@@ -74,9 +74,20 @@ export function open_send_later_menu() {
current_time.getTime() +
scheduled_messages.MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS * 1000,
),
onClose() {
onClose(selectedDates, _dateStr, instance) {
// Return to normal state.
$send_later_modal_content.css("pointer-events", "all");
const selected_date = selectedDates[0];
if (selected_date && selected_date < instance.config.minDate) {
scheduled_messages.set_minimum_scheduled_message_delay_minutes_note(
true,
);
} else {
scheduled_messages.set_minimum_scheduled_message_delay_minutes_note(
false,
);
}
},
},
);