@@ -217,6 +217,11 @@ listings_UI <- function(module_id) { # nolint
217217# ' @param on_sbj_click `[function()]`
218218# '
219219# ' Function to invoke when a subject ID is clicked in a listing
220+ # '
221+ # ' @param review `[list()]`
222+ # '
223+ # ' Configuration of the experimental data review feature.
224+ # ' For more details, please refer to `vignette("data_review")`.
220225# '
221226# ' @export
222227listings_server <- function (module_id ,
@@ -389,7 +394,7 @@ listings_server <- function(module_id,
389394 " clear_filters" ,
390395 # NOTE(miguel): Added here for easier merge with other branches
391396 # TODO(miguel): Move elsewhere after merging
392- REV_UI(ns = ns , roles = review [[ " roles " ]] )[[" input_ids_to_exclude_from_bookmarking" ]]
397+ REV_UI(ns = ns , roles = character ( 0 ) )[[" input_ids_to_exclude_from_bookmarking" ]]
393398 ))
394399
395400 # Bookmarking (end)
@@ -429,6 +434,10 @@ listings_server <- function(module_id,
429434 } else {
430435 fs_client <- fs_init(fs_callbacks , review [[" store_path" ]])
431436 }
437+
438+ # Overly restrictive sanitization of role strings, as they will be used for file names:
439+ # TODO: Consider adapting https://github.com/r-lib/fs/blob/main/R/sanitize.R instead to allow alternative charsets
440+ review [[" roles" ]] <- gsub(" [^a-zA-Z0-9 _.-]" , " " , review [[" roles" ]]) # Accepts alpha+num+space+'.'+'_'+'-'
432441
433442 output [[TBL $ REVIEW_UI_ID ]] <- shiny :: renderUI(
434443 shinyWidgets :: dropdownButton(
@@ -919,12 +928,12 @@ check_mod_listings <- function(afmm, datasets, module_id, dataset_names,
919928 ) &&
920929 CM $ assert(
921930 container = err ,
922- cond = (checkmate :: test_character(info [[" tracked_vars" ]], min.chars = 1 , unique = TRUE ) &&
931+ cond = (checkmate :: test_character(info [[" tracked_vars" ]], min.chars = 1 , min.len = 3 , unique = TRUE ) &&
923932 checkmate :: test_subset(info [[" tracked_vars" ]], names(dataset ))),
924933 msg = sprintf(
925934 paste(
926- " `review$datasets$%s$tracked_vars` should be a character vector listing a subset of the columns " ,
927- " available in dataset `%s`"
935+ " `review$datasets$%s$tracked_vars` should be a character vector listing a subset of" ,
936+ " at least three columns available in dataset `%s`"
928937 ), domain , domain
929938 )
930939 )
0 commit comments