Skip to content

Commit

Permalink
Fix partial match of use.name to use.names in unlist()
Browse files Browse the repository at this point in the history
  • Loading branch information
jthompson-arcus committed Feb 27, 2024
1 parent ae26d06 commit 8a7af90
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion R/mod_addComment.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ addCommentServer <- function(id, metric_abrv, user, credentials, pkg_name) {

observeEvent(input$submit_comment, {
req(input$add_comment)
req("general_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("general_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

comment <- trimws(input$add_comment)

Expand Down
2 changes: 1 addition & 1 deletion R/mod_code_explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgdir = reactiveVal(), c
),
br(), br(),
div(id = ns("comments_for_fe"), fluidRow(
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) addCommentUI(id = ns("add_comment")),
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) addCommentUI(id = ns("add_comment")),
viewCommentsUI(id = ns("view_comments"))))
)
}
Expand Down
2 changes: 1 addition & 1 deletion R/mod_communityMetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ communityMetricsServer <- function(id, selected_pkg, community_metrics, user, cr
plotly::plotlyOutput(NS(id, "downloads_plot"), height = "500px")))),
br(), br(),
div(id = "comments_for_cum", fluidRow(
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) addCommentUI(id = session$ns("add_comment")),
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) addCommentUI(id = session$ns("add_comment")),
viewCommentsUI(id = session$ns("view_comments"))))
)
}
Expand Down
18 changes: 9 additions & 9 deletions R/mod_decision_automation.R
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ mod_decision_automation_server <- function(id, user, credentials){
#### Outputs ####
purrr::walk(c("auto_dropdown", "auto_dropdown2"), ~
observeEvent(input[[.x]], {
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

showModal(modalDialog(
size = "l",
Expand Down Expand Up @@ -515,7 +515,7 @@ mod_decision_automation_server <- function(id, user, credentials){
})

output$auto_classify <- renderUI({
if ("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) {
if ("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) {
tagList(
br(),br(),
hr(),
Expand All @@ -540,7 +540,7 @@ mod_decision_automation_server <- function(id, user, credentials){
})

output$decision_rule_div <- renderUI({
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
tagList(
div(
style = "display: flex",
Expand Down Expand Up @@ -625,7 +625,7 @@ mod_decision_automation_server <- function(id, user, credentials){

output$auto_settings <-
renderUI({
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

div(
style = "float: right;",
Expand All @@ -637,7 +637,7 @@ mod_decision_automation_server <- function(id, user, credentials){

output$auto_settings2 <-
renderUI({
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

div(
style = "float: right;",
Expand Down Expand Up @@ -721,7 +721,7 @@ mod_decision_automation_server <- function(id, user, credentials){
})

observeEvent(input$submit_auto, {
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

showModal(modalDialog(
size = "l",
Expand Down Expand Up @@ -752,7 +752,7 @@ mod_decision_automation_server <- function(id, user, credentials){
})

observeEvent(input$submit_color, {
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

showModal(modalDialog(
size = "l",
Expand Down Expand Up @@ -784,7 +784,7 @@ mod_decision_automation_server <- function(id, user, credentials){
})

observeEvent(input$confirm_submit_auto, {
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
req(!disable_auto_submit())

out_lst <- purrr::compact(reactiveValuesToList(auto_decision))
Expand Down Expand Up @@ -829,7 +829,7 @@ mod_decision_automation_server <- function(id, user, credentials){


observeEvent(input$confirm_submit_col, {
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

selected_colors <-
decision_lst %>%
Expand Down
2 changes: 1 addition & 1 deletion R/mod_introJS.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ introJSServer <- function(id, text, user, credentials) {
moduleServer(id, function(input, output, session) {

steps <- reactive({
if(user$admin || "weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) {
if(user$admin || "weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) {
apptab_steps <- bind_rows(apptab_admn, apptab_steps)
}

Expand Down
2 changes: 1 addition & 1 deletion R/mod_maintenanceMetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ maintenanceMetricsServer <- function(id, selected_pkg, maint_metrics, user, cred
metricGridUI(NS(id, 'metricGrid')),
br(), br(),
fluidRow(div(id = "comments_for_mm",
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) addCommentUI(NS(id, 'add_comment')),
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) addCommentUI(NS(id, 'add_comment')),
viewCommentsUI(NS(id, 'view_comments')))
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/mod_pkg_explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ mod_pkg_explorer_server <- function(id, selected_pkg,
),
br(), br(),
div(id = ns("comments_for_se"), fluidRow(
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) addCommentUI(id = ns("add_comment")),
if ("general_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) addCommentUI(id = ns("add_comment")),
viewCommentsUI(id = ns("view_comments")))),
id = id
)
Expand Down
2 changes: 1 addition & 1 deletion R/mod_reportPreview.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ reportPreviewServer <- function(id, selected_pkg, maint_metrics, com_metrics,

br(), br(),

if ("overall_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
if ("overall_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
div(id = NS(id, "pkg-summary-grp"),
# Compose pkg summary - either disabled, enabled, or pre-populated
uiOutput(NS(id, "pkg_summary_ui")),
Expand Down
10 changes: 5 additions & 5 deletions R/mod_reweightView.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ reweightViewServer <- function(id, user, decision_list, credentials) {
)

observeEvent(input$update_weight, {
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
curr_new_wts(save$data %>%
dplyr::mutate(new_weight = ifelse(name == isolate(input$metric_name),
isolate(input$metric_weight), new_weight)))
Expand Down Expand Up @@ -184,7 +184,7 @@ reweightViewServer <- function(id, user, decision_list, credentials) {

# Update metric weight dropdown so that it matches the metric name.
observeEvent(input$metric_name, {
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

shinyjs::disable("update_weight")
updateNumericInput(session, "metric_weight",
Expand All @@ -199,14 +199,14 @@ reweightViewServer <- function(id, user, decision_list, credentials) {
# Note that another of the observeEvents will update the metric weight after
# the selected metric name is updated.
observeEvent(input$weights_table_rows_selected, {
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
updateSelectInput(session, "metric_name",
selected = curr_new_wts()$name[input$weights_table_rows_selected])
})

# Save new weight into db.
observeEvent(input$update_pkg_risk, {
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

# if you the user goes input$back2dash, then when they return to the
if(n_wts_chngd() == 0){
Expand Down Expand Up @@ -243,7 +243,7 @@ reweightViewServer <- function(id, user, decision_list, credentials) {

# Upon confirming the risk re-calculation
observeEvent(input$confirm_update_risk, {
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("weight_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
removeModal()

session$userData$trigger_events[["reset_pkg_upload"]] <- session$userData$trigger_events[["reset_pkg_upload"]] + 1
Expand Down
20 changes: 10 additions & 10 deletions R/mod_sidebar.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {

# Update db if comment is submitted.
observeEvent(input$submit_overall_comment, {
req("overall_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("overall_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

current_comment <- trimws(input$overall_comment)

Expand Down Expand Up @@ -277,7 +277,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
observeEvent(input$submit_overall_comment_yes, {

req(selected_pkg$name)
req("overall_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("overall_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

dbUpdate(
"UPDATE comments
Expand Down Expand Up @@ -334,7 +334,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
observeEvent(req(input$select_ver, session$userData$trigger_events$reset_sidebar), {
if (input$select_pkg != "-" && input$select_ver != "-" &&
(rlang::is_empty(selected_pkg$decision) || is.na(selected_pkg$decision)) &&
"overall_comment" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) {
"overall_comment" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) {
shinyjs::enable("overall_comment")
shinyjs::enable("submit_overall_comment")

Expand All @@ -345,7 +345,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
}, ignoreInit = TRUE)

observeEvent(req(input$select_ver, session$userData$trigger_events$reset_sidebar), {
req("final_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("final_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

if (input$select_pkg != "-" && input$select_ver != "-" &&
(rlang::is_empty(selected_pkg$decision) || is.na(selected_pkg$decision))) {
Expand All @@ -363,7 +363,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {

if (!(input$select_pkg == "-" && input$select_ver == "-" ||
(rlang::is_empty(selected_pkg$decision) || is.na(selected_pkg$decision))) &&
"revert_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) {
"revert_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) {
shinyjs::hide("submit_decision")
} else {
shinyjs::show("submit_decision")
Expand All @@ -375,7 +375,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
output$reset_decision_ui <- renderUI({
req(user$role)
req(credentials$privileges)
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))
req(!(input$select_pkg == "-" && input$select_ver == "-" ||
(rlang::is_empty(selected_pkg$decision) || is.na(selected_pkg$decision))))

Expand All @@ -385,7 +385,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
# Show a confirmation modal when submitting a decision.
observeEvent(input$submit_decision, {
req(input$decision)
req("final_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("final_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

showModal(modalDialog(
size = "l",
Expand All @@ -412,7 +412,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
# Show a confirmation modal when resetting a decision
observeEvent(input$reset_decision, {
req(input$decision)
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

showModal(modalDialog(
size = "l",
Expand Down Expand Up @@ -440,7 +440,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {

# Update database info after decision is submitted.
observeEvent(input$submit_confirmed_decision, {
req("final_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("final_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

dbUpdate("UPDATE package
SET decision_id = {match(input$decision, golem::get_golem_options(\"decision_categories\"))}, decision_by = {user$name}, decision_date = {get_Date()}
Expand All @@ -462,7 +462,7 @@ sidebarServer <- function(id, user, uploaded_pkgs, credentials) {
})

observeEvent(input$reset_confirmed_decision, {
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("revert_decision" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

dbUpdate("UPDATE package
SET decision_id = NULL, decision_by = '', decision_date = NULL
Expand Down
14 changes: 7 additions & 7 deletions R/mod_uploadPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {
req(user$role)
req(credentials$privileges)

if ("add_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) {
if ("add_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) {
shinyjs::enable("pkg_lst")
shinyjs::enable("add_pkgs")
shinyjs::enable("uploaded_file")
Expand All @@ -108,7 +108,7 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {
})

output$upload_format_lnk <- renderUI({
req("add_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("add_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

actionLink(NS(id, "upload_format"), "View Sample Dataset")
})
Expand All @@ -119,9 +119,9 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {

dplyr::bind_rows(
upload_pkg,
if ("add_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) upload_pkg_add,
if ("delete_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) upload_pkg_delete,
if ("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.name = FALSE)) upload_pkg_dec_adj,
if ("add_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) upload_pkg_add,
if ("delete_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) upload_pkg_delete,
if ("auto_decision_adjust" %in% unlist(credentials$privileges[user$role], use.names = FALSE)) upload_pkg_dec_adj,
if (nrow(uploaded_pkgs()) > 0) upload_pkg_comp
)
})
Expand Down Expand Up @@ -165,7 +165,7 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {
output$rem_pkg_div <- renderUI({
req(user$role)
req(credentials$privileges)
req("delete_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("delete_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

session$onFlushed(function() {
shinyjs::runjs(glue::glue('$("#{NS(id, "rem_pkg_btn")}").css("margin-top", $("#{NS(id, "rem_pkg_lst")}-label")[0].scrollHeight + .5*parseFloat(getComputedStyle(document.documentElement).fontSize))'))
Expand Down Expand Up @@ -246,7 +246,7 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {
})

observeEvent(input$rem_pkg_btn, {
req("delete_package" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("delete_package" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

np <- length(input$rem_pkg_lst)
uploaded_packages <-
Expand Down
2 changes: 1 addition & 1 deletion R/mod_user_roles.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ mod_user_roles_server <- function(id, user, credentials){
})

observeEvent(input$submit_changes, {
req("admin" %in% unlist(credentials$privileges[user$role], use.name = FALSE))
req("admin" %in% unlist(credentials$privileges[user$role], use.names = FALSE))

chng_lst <- dplyr::filter(role_changes(), paste(old_role) != paste(new_role))
purrr::pmap(chng_lst, function(old_role, new_role) {
Expand Down

0 comments on commit 8a7af90

Please sign in to comment.