Skip to content

Conversation

@chintanjoshi-apphelix-2u
Copy link

@chintanjoshi-apphelix-2u chintanjoshi-apphelix-2u commented Nov 17, 2025

Description

Implements soft delete functionality for discussion threads, responses, and comments using the is_deleted flag instead of permanently deleting records.
This enables safe deletion and restoration of discussion content while preserving existing data.


Changes Made

  • Added soft delete and restore functionality for threads, responses, and comments.
  • Introduced support to view deleted content in the Learner tab using a new Active / Deleted filter.
  • Implemented restore actions for deleted threads, responses, and comments.
  • Added deleted count tracking and support for sorting by deleted count in the Learner tab.
  • Implemented bulk delete and bulk restore actions for discussion content.
  • Ensured nested responses and comments are handled correctly during delete and restore operations.
  • Added API support to fetch deleted content for moderation workflows.

Note:
Features listed above (except soft delete itself) are available only to Staff, Admins, Moderators, and TAs.


JIRA Tickets

  • COSMO2-742Link
  • COSMO2-769Link
  • COSMO2-783Link

Related Pull Requests

@chintanjoshi-apphelix-2u chintanjoshi-apphelix-2u marked this pull request as ready for review December 18, 2025 07:52
Copilot AI review requested due to automatic review settings December 18, 2025 07:52
Copy link

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 pull request implements soft delete functionality for the forum discussion system, allowing content to be marked as deleted without permanently removing it from the database.

Key Changes:

  • Adds is_deleted, deleted_at, and deleted_by fields to track soft deletion metadata for threads and comments
  • Implements soft delete operations that set deletion flags instead of permanently removing content
  • Adds restoration functionality to undelete previously soft-deleted content
  • Includes new API endpoints for bulk restore operations and viewing deleted content

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openedx/core/djangoapps/django_comment_common/comment_client/utils.py Formatting changes, quote style standardization
openedx/core/djangoapps/django_comment_common/comment_client/thread.py Adds soft delete/restore methods and deletion metadata fields to Thread model
openedx/core/djangoapps/django_comment_common/comment_client/models.py Updates delete methods to support deleted_by parameter and improved error handling
openedx/core/djangoapps/django_comment_common/comment_client/comment.py Adds soft delete/restore methods and deletion metadata fields to Comment model
lms/djangoapps/discussion/rest_api/views.py Adds new API endpoints for restore operations and viewing deleted content
lms/djangoapps/discussion/rest_api/urls.py Registers new API endpoint URLs for restore and deleted content operations
lms/djangoapps/discussion/rest_api/tasks.py Updates bulk delete/restore tasks to track deleted_by metadata
lms/djangoapps/discussion/rest_api/serializers.py Adds serialization for deletion metadata fields
lms/djangoapps/discussion/rest_api/forms.py Adds show_deleted form field for filtering deleted content
lms/djangoapps/discussion/rest_api/tests/*.py Updates test files with formatting changes and new deletion field expectations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants