diff --git a/R/email.R b/R/email.R index 7e738232..2555e9b3 100644 --- a/R/email.R +++ b/R/email.R @@ -332,17 +332,29 @@ emailReportServer <- function(id, }) shiny::observeEvent(input$send, { if (iv$is_valid()) { - email_async( + toggle_email_input_elements() + promise_list <- email_async( to = input$recipient, dois = dois(), translator = translWithLang() ) + promises::then( + promise_list$done, + onFulfilled = function(value) toggle_email_input_elements() + ) } }) } ) } +#' @describeIn emailreport Dis/enable all input elements in the module +toggle_email_input_elements <- function() { + shinyjs::toggleState("recipient") + shinyjs::toggleState("gdpr_consent") + shinyjs::toggleState("send") +} + #' @describeIn emailReport Promise of a rendered and send email #' Emits notifications and progress bar updates. #' @inheritParams mc_compose_email