diff --git a/scripts/mills_messages.mjs b/scripts/mills_messages.mjs index 2383e79..578841a 100644 --- a/scripts/mills_messages.mjs +++ b/scripts/mills_messages.mjs @@ -71,16 +71,24 @@ async function create_history_journal(user) { * This allows us to populate the form with previous inputs and go back and forth * within the chain, to be able to fix mistakes or send fewer messages. * + * We also use this to pre-fill the first form with data if any is passed. + * * NOTE: The recipients are the same for all the messages of a chain, to simplify * the processing later as we only have to build one array of messages, shared among * the recipients. + * + * @param {MessageFormResponse|null} initial_form_data Data to pre-fill the first form with. * @returns {Promise} The Promise for the processing of the messages. */ -async function send_message_dialog() { +async function send_message_dialog(initial_form_data = null) { /** @type{MessageFormResponse[]} */ let messages = [] let current_message = 0 + if (initial_form_data !== null) { + messages.push(initial_form_data); + } + let chain = false; do { if (chain) {