popover_menus: Show last selected time in send later popover.

This commit is contained in:
Aman Agrawal 2023-05-01 17:35:36 +00:00 committed by Tim Abbott
parent ee354bb007
commit 12a2e3122f
3 changed files with 10 additions and 20 deletions

View File

@ -859,7 +859,10 @@ export function initialize() {
}, },
onMount(instance) { onMount(instance) {
const $popper = $(instance.popper); const $popper = $(instance.popper);
$popper.one("click", ".send_later_selected_send_later_time", () => {
const send_at_timestamp = get_selected_send_later_timestamp();
do_schedule_message(send_at_timestamp);
});
$popper.one("click", ".open_send_later_modal", () => { $popper.one("click", ".open_send_later_modal", () => {
if (!compose_validate.validate()) { if (!compose_validate.validate()) {
return; return;
@ -877,13 +880,11 @@ export function initialize() {
possible_send_later_today = false; possible_send_later_today = false;
} }
const formatted_send_later_time = get_formatted_selected_send_later_time();
$("body").append( $("body").append(
render_send_later_modal({ render_send_later_modal({
possible_send_later_today, possible_send_later_today,
send_later_tomorrow, send_later_tomorrow,
send_later_custom, send_later_custom,
formatted_send_later_time,
}), }),
); );
overlays.open_modal("send_later_modal", { overlays.open_modal("send_later_modal", {
@ -911,18 +912,7 @@ export function initialize() {
".send_later_today, .send_later_tomorrow", ".send_later_today, .send_later_tomorrow",
(e) => { (e) => {
const send_at_time = set_compose_box_schedule(e.currentTarget); const send_at_time = set_compose_box_schedule(e.currentTarget);
const not_from_flatpickr = true; do_schedule_message(send_at_time);
do_schedule_message(send_at_time, not_from_flatpickr);
e.preventDefault();
e.stopPropagation();
},
);
$send_later_modal.one(
"click",
".send_later_selected_send_later_time",
(e) => {
const send_at_timestamp = get_selected_send_later_timestamp();
do_schedule_message(send_at_timestamp);
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
}, },

View File

@ -22,11 +22,6 @@
<a id="{{@key}}" class="send_later_tomorrow" tabindex="0">{{this.text}}</a> <a id="{{@key}}" class="send_later_tomorrow" tabindex="0">{{this.text}}</a>
</li> </li>
{{/each}} {{/each}}
{{#if formatted_send_later_time}}
<li>
<a class="send_later_selected_send_later_time" tabindex="0">{{formatted_send_later_time}}</a>
</li>
{{/if}}
<li> <li>
<a class="send_later_custom" tabindex="0">{{t 'Custom time'}}</a> <a class="send_later_custom" tabindex="0">{{t 'Custom time'}}</a>
</li> </li>

View File

@ -2,6 +2,11 @@
<li> <li>
<a class="open_send_later_modal" tabindex="0">{{t "Schedule message" }}</a> <a class="open_send_later_modal" tabindex="0">{{t "Schedule message" }}</a>
</li> </li>
{{#if formatted_send_later_time}}
<li>
<a class="send_later_selected_send_later_time" tabindex="0">{{t 'Schedule for {formatted_send_later_time}' }}</a>
</li>
{{/if}}
<hr /> <hr />
<li> <li>
<a href="#scheduled" tabindex="0">{{t "View scheduled messages" }}</a> <a href="#scheduled" tabindex="0">{{t "View scheduled messages" }}</a>