compose: Open send later modal when user accepts the warning on scheduling message.

When the user has a wildcard @-mention we show a warning if the stream has more than
15 members. When the user clicks "Yes, schedule" and confirms the intend to schedule
the message we open the send later modal to let user choose scheduling time.

Fixes #25426.
This commit is contained in:
Lalit
2023-05-04 19:34:30 +05:30
committed by Tim Abbott
parent 87397ed000
commit 577c150ffa
3 changed files with 9 additions and 1 deletions

View File

@@ -480,6 +480,13 @@ export function initialize() {
compose_validate.set_user_acknowledged_wildcard_flag(true); compose_validate.set_user_acknowledged_wildcard_flag(true);
if (is_edit_input) { if (is_edit_input) {
message_edit.save_message_row_edit($row); message_edit.save_message_row_edit($row);
} else if (event.target.dataset.validationTrigger === "schedule") {
popover_menus.open_send_later_menu();
// We need to set this flag to true here because `open_send_later_menu` validates the message and sets
// the user acknowledged wildcard flag back to 'false' and we don't want that to happen because then it
// would again show the wildcard warning banner when we actually send the message from 'send-later' modal.
compose_validate.set_user_acknowledged_wildcard_flag(true);
} else { } else {
finish(); finish();
} }

View File

@@ -251,6 +251,7 @@ function show_wildcard_warnings(opts) {
button_text, button_text,
hide_close_button: true, hide_close_button: true,
classname, classname,
scheduling_message: opts.scheduling_message,
}); });
// only show one error for any number of @all or @everyone mentions // only show one error for any number of @all or @everyone mentions

View File

@@ -9,7 +9,7 @@
<div class="banner_content">{{> @partial-block}}</div> <div class="banner_content">{{> @partial-block}}</div>
{{/if}} {{/if}}
{{#if button_text}} {{#if button_text}}
<button class="compose_banner_action_button{{#if hide_close_button}} right_edge{{/if}}" >{{button_text}}</button> <button class="compose_banner_action_button{{#if hide_close_button}} right_edge{{/if}}" {{#if scheduling_message}}data-validation-trigger="schedule"{{/if}}>{{button_text}}</button>
{{/if}} {{/if}}
{{#if hide_close_button}} {{#if hide_close_button}}
{{!-- hide_close_button is null by default, and false if explicitly set as false. --}} {{!-- hide_close_button is null by default, and false if explicitly set as false. --}}