Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-date', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n'), 'version' => 'b5ccad3e6b35e5c88a78');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-date', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n'), 'version' => '7e5c3b61d532e8ba822f');
2 changes: 1 addition & 1 deletion src/bp-core/admin/bb-settings/settings/build/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export function AccessControlField( { field, value, onChange } ) {
return data.current_sub_type || '';
} );
var [ options, setOptions ] = useState( data.options || [] );
// Recipient list for threaded "Specific" checkboxes: the FULL role set
// (includes administrators + the sender's own role), unlike `options` which
// is the admin-excluded sender list. Falls back to `options` when the server
// provides no separate recipient list (legacy parity — see renderThreadedCheckboxes).
var [ recipientOptions, setRecipientOptions ] = useState( data.recipient_options || data.options || [] );
var [ selectedOptions, setSelectedOptions ] = useState( value?.[ 'access-control-options' ] || [] );
var [ loading, setLoading ] = useState( false );
var [ fetchError, setFetchError ] = useState( '' );
Expand Down Expand Up @@ -179,6 +184,7 @@ export function AccessControlField( { field, value, onChange } ) {
// Reset to placeholder — save to clear the setting.
if ( ! newType ) {
setOptions( [] );
setRecipientOptions( [] );
onChange( {
'access-control-type': '',
'access-control-options': [],
Expand All @@ -198,6 +204,7 @@ export function AccessControlField( { field, value, onChange } ) {
// If this type has sub-types, don't fetch options yet — wait for sub-type selection.
if ( typeConfig && typeConfig.sub_types && typeConfig.sub_types.items && typeConfig.sub_types.items.length > 0 ) {
setOptions( [] );
setRecipientOptions( [] );
return;
}

Expand All @@ -220,6 +227,7 @@ export function AccessControlField( { field, value, onChange } ) {
var newOptions = response?.data?.options || [];
newOptions = wp.hooks.applyFilters( 'bb.accessControl.options', newOptions, field, newType );
setOptions( newOptions );
setRecipientOptions( response?.data?.recipient_options || response?.data?.options || [] );
setLoading( false );
} ).catch( function( error ) {
if ( error && 'AbortError' === error.name ) {
Expand All @@ -244,6 +252,7 @@ export function AccessControlField( { field, value, onChange } ) {

if ( ! newSubType || ! typeConfig || ! typeConfig.sub_types ) {
setOptions( [] );
setRecipientOptions( [] );
return;
}

Expand All @@ -265,6 +274,7 @@ export function AccessControlField( { field, value, onChange } ) {
var newOptions = response?.data?.options || [];
newOptions = wp.hooks.applyFilters( 'bb.accessControl.options', newOptions, field, selectedType, newSubType );
setOptions( newOptions );
setRecipientOptions( response?.data?.recipient_options || response?.data?.options || [] );
setLoading( false );
} ).catch( function( error ) {
if ( error && 'AbortError' === error.name ) {
Expand Down Expand Up @@ -400,11 +410,15 @@ export function AccessControlField( { field, value, onChange } ) {
* @return {JSX.Element} Checkbox list.
*/
var renderThreadedCheckboxes = function( optKey, subSettings ) {
// Recipient list = the FULL role set, including administrators and the
// sender's own role. The sender toggle rows (`options`) exclude
// administrators, but the recipient checkboxes must list every role —
// matching legacy multiple-options.php, which looped the full list. Fall
// back to `options` for types that have no separate recipient list.
var recipientList = ( recipientOptions && recipientOptions.length ) ? recipientOptions : options;
return (
<div className="bb-access-control-field__threaded-checkboxes">
{ options.filter( function( o ) {
return String( o.value ) !== optKey;
} ).map( function( o ) {
{ recipientList.map( function( o ) {
var specKey = String( o.value );
return (
<CheckboxControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@

[data-field-name="bb-access-control-create-activity"] &,
[data-field-name="bb-access-control-create-groups"] &,
[data-field-name="bb-access-control-join-groups"] &,
[data-field-name="bb-access-control-upload-media"] &,
[data-field-name="bb-access-control-upload-video"] &,
[data-field-name="bb-access-control-upload-document"] & {
Expand Down
Loading