#2863 - List Bulk Edit - Share And Follow Functionality Missing#2872
Conversation
kodinkat
commented
Jan 26, 2026
- fixes: List Bulk Edit - Share and Follow functionality missing. #2863
…ields with typeahead support for user selection. Implement special handling for these fields in the bulk edit process, including payload adjustments for sharing actions. Ensure backward compatibility with legacy share input handling.
|
@corsacca review ready.... |
Added: Option to remove share from a person: https://github.com//issues/2858
@kodinkat can the share select use a dt-component instead of the old typeahead field? |
…ools-theme into 2863-list-bulk-edit-share-and-follow-functionality-missing
- Introduced support for a new share payload format, allowing for user-specific sharing actions.
- Added backward compatibility for legacy share formats to ensure seamless user experience.
- Implemented dynamic handling of share and follow fields, improving the bulk edit process.
- Refactored share input handling to accommodate both new and legacy formats, enhancing maintainability.
- Removed outdated bulk edit field selection logic from modular-list.js, centralizing functionality in modular-list-bulk.js.
- Updated share field logic to support multiple user selections, improving user experience.
- Refactored user ID collection to accommodate both new and legacy formats, ensuring backward compatibility.
- Enhanced initial value setup for share fields to handle arrays of user IDs, streamlining the bulk edit process.
- Improved error handling for parsing user data from the share component, ensuring robustness in data retrieval.
|
@corsacca review ready.....
|
| }); | ||
| } | ||
|
|
||
| /*** |
There was a problem hiding this comment.
@kodinkat bulk operation belong in modular-list-bulk.js now. Can you move this there (or is it there already?)
There was a problem hiding this comment.
THis section might not be needed.
|
Concerns
Curious about this one: |
…ools-theme into 2863-list-bulk-edit-share-and-follow-functionality-missing
- Introduced a new utility function, normalizeShareComponentItems, to standardize the handling of share component values, improving robustness against various input types.
- Refactored existing logic to utilize the new utility function, streamlining the process of extracting user IDs from share components.
- Updated documentation to clarify the purpose of the module and the organization of bulk-related features.
…ted comments. The bulk delete logic has been relocated to modular-list-bulk.js to streamline the codebase and improve maintainability.
|
test comment |
Code ReviewGood progress on adding share and follow to bulk edit. A few issues worth addressing before merge. |
|
Deleting previous test comments - please ignore comments 3972661425 and 3972663037 |
Code ReviewGood progress on adding share and follow to bulk edit. A few issues worth addressing before merge: Bug: current_user_id is not in scope In the new The existing follow handler uses const currentUserId =
window.wpApiNotifications?.current_user_id || DT_List.current_user_id;Missing unshare functionality The new Performance: fetching all users for field restoration When restoring a previously selected user in the share field, the code fetches the entire user list ( Unhandled promise rejection in change listener The change event listener is processShareComponentValue is unnecessarily async The function body has no Minor: redundant some + find In the share field section, Existing note on normalizeShareComponentItems Agree with @corsacca — the function defensively handles string "null", "[]", object Summary: The |
|
Note: comments 3972661425 and 3972663037 and 3972663836 above were test/cleanup comments and can be ignored. The actual review is in the comment immediately below. |
- Simplified the logic for checking and processing share field data, improving readability and maintainability.
- Updated the processShareComponentValue function to handle errors more gracefully and ensure compatibility with existing data structures.
- Enhanced event listener for share component changes to better manage asynchronous updates and error logging.
Code ReviewGood progress on adding share and follow to bulk edit. One regression stands out as a blocker, along with a few other items. Regression: field clearing is broken for all field types
This affects all clearable field types, not just share/follow. Fix: either keep the original Dead code: new share payload format is never triggeredThe queue processor now has two branches for share payloads: // Never reached by new code path
if (share && share.user_id && share.action === 'add') { ... }
// Always used by new code path (legacy format)
else if (share && share['users']) { ... }The new Unshare is hardcoded to
|
- Clarified comments regarding share payload formats and the use of legacy formats for multiple users.
- Updated the toggle handling for clearable fields to use a more descriptive class name.
- Enhanced the follow HTML generation to escape label and help text, improving security against HTML injection.
- Delegated the 'Remove Values' mode toggle to ensure proper handling of clearable fields.
Code ReviewGood work adding Share and Follow to the bulk edit field selector — the feature fills a clear gap from #2863. A few issues to address: Bug: Missing i18n translation keysThe new labels rely on These translation keys need to be added to // in the wpApiShare translations array
'share' => __( 'Share', 'disciple_tools' ),
'follow' => __( 'Follow', 'disciple_tools' ),
'follow_help' => __( 'Toggle to follow or unfollow records', 'disciple_tools' ),Dead code: single-user add branch in
|
…ts.php
- Added new translation strings for 'Share', 'Follow', and 'Follow Help' in enqueue-scripts.php to improve user interface clarity.
- Refactored the processShareComponentValue function in modular-list-bulk.js to streamline the handling of share component values, ensuring compatibility with various input formats.
- Improved error handling and logging for component initialization and value processing, enhancing robustness and maintainability.
|
test |
Code ReviewGood work adding Share and Follow to the bulk edit UI — this fills a real usability gap (#2863). The overall structure is sound and the new fields integrate cleanly with the existing bulk-edit pipeline. A few things worth addressing before merge: Potential Regression – Mode Toggle Event DelegationThe PR refactors how the "Remove Values" mode toggle ( Before – a direct event listener was attached per-field when modeToggle[0].addEventListener('change', function () {
handleModeToggleChange(this);
});After – that listener is removed and replaced by a single document-level delegated handler: $(document).on('change', '.bulk-edit-mode-toggle', function () {
handleModeToggleChange(this);
});Event delegation only fires for events that bubble. The Dead Code PathThe new single-user add-share format is added with a comment saying no code path produces it: // Single-user add format { user_id, action: 'add' } — reserved for future use;
// no code path produces it yet
if (share && share.user_id && share.action === 'add') { ... }Dead code that is explicitly "reserved for future use" adds maintenance burden. Consider removing it and adding it in the PR that actually introduces the consuming code. Silent Failure When
|
|
@corsacca review ready..... |
|
Thank you @kodinkat! |
Code ReviewThe PR fills a real gap - Share and Follow were missing from bulk edit (#2863). The overall approach is sound, and the iteration since the first review has addressed several earlier concerns (module-scope helpers, correct 1. Potential Regression - Mode Toggle Event Delegation (most important)The PR removes the per-field direct event listener on Please verify that 2. Dead Code PathThe single-user add block ( 3. Silent Failure When currentUserId is MissingIn 4. Comment AccuracyThe new share UI added in this PR also produces the 5. Translation Key Placement (minor)
What Looks Good
|

