Skip to content

Commit

Permalink
block email inputs once send is underway
Browse files Browse the repository at this point in the history
  • Loading branch information
maxheld83 committed Nov 11, 2021
1 parent a54e90b commit 990ad2c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion R/email.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 990ad2c

Please sign in to comment.