Skip to content

Conversation

Alam-2U
Copy link

@Alam-2U Alam-2U commented Oct 6, 2025

Description

Restores bulk delete user posts feature that was reverted in #818, bringing back course/org-scoped deletion with privilege controls.

Original implementation: #37030
Issues with original implementation: #37402

The frontend changes were removed from Open edX but are being restored in the edX fork.
Backend PRs for feature removal are still unmerged : #37401, #37403

Jira Ticket: LP-120

@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 12:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores bulk delete user posts functionality for privileged users in discussion forums, allowing course and organization-scoped deletion of user posts. This feature was previously reverted in issue openedx#818 and is now being restored with proper privilege controls.

  • Added bulk delete APIs and Redux state management for user post deletion
  • Created learner actions dropdown component with delete options for course/org scoped deletion
  • Implemented confirmation dialog with post count statistics before deletion

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/index.scss Updated dropdown item width from fixed to min-width for better responsiveness
src/discussions/learners/utils.js Added utility functions and constants for learner actions including delete operations
src/discussions/learners/test-utils.js Extended test utilities to support bulk delete functionality and privilege setup
src/discussions/learners/messages.js Added internationalization messages for delete confirmation dialogs
src/discussions/learners/data/thunks.js Implemented deleteUserPosts thunk for API communication
src/discussions/learners/data/slices.js Added Redux state management for bulk delete operations and statistics
src/discussions/learners/data/selectors.js Added selector for bulk delete statistics
src/discussions/learners/data/constants.js Defined bulk delete type constants for course/org scoping
src/discussions/learners/data/api.test.jsx Added comprehensive tests for bulk delete API functionality
src/discussions/learners/data/api.js Implemented bulk delete API endpoint and documentation
src/discussions/learners/LearnerPostsView.test.jsx Added tests for bulk delete UI interactions and confirmation flows
src/discussions/learners/LearnerPostsView.jsx Integrated bulk delete dropdown and confirmation dialog into main view
src/discussions/learners/LearnerActionsDropdown.test.jsx Added tests for the actions dropdown component
src/discussions/learners/LearnerActionsDropdown.jsx Created dropdown component for learner actions including delete options
src/discussions/data/slices.js Added bulk delete privileges to course configuration state
src/discussions/data/selectors.js Added selector for bulk delete privileges
src/data/constants.js Added content action constants for delete operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

handleActions(action.action);
}}
className="d-flex justify-content-start actions-dropdown-item"
data-testId={action.id}
Copy link
Preview

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'data-testId' to 'data-testid' (lowercase 'i' in 'id').

Suggested change
data-testId={action.id}
data-testid={action.id}

Copilot uses AI. Check for mistakes.

);

it('Failed to bulk delete user posts', async () => {
const learners = await setupPostsMockResponse({ statusCode: 400 });
Copy link
Preview

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is calling setupPostsMockResponse instead of setupDeleteUserPostsMockResponse for testing bulk delete failure. This will test the wrong API endpoint.

Suggested change
const learners = await setupPostsMockResponse({ statusCode: 400 });
const learners = await setupDeleteUserPostsMockResponse({ statusCode: 400 });

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants