Skip to content

feat: added soft delete functionality#83

Merged
Alam-2U merged 1 commit intorelease-ulmofrom
Cosmo2-793
Jan 14, 2026
Merged

feat: added soft delete functionality#83
Alam-2U merged 1 commit intorelease-ulmofrom
Cosmo2-793

Conversation

@Alam-2U
Copy link

@Alam-2U Alam-2U commented Jan 12, 2026

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
  • COSMO2-793Link

Related Pull Requests

@Alam-2U Alam-2U marked this pull request as ready for review January 13, 2026 10:56
Copilot AI review requested due to automatic review settings January 13, 2026 10:56
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 discussion threads, responses, and comments using an is_deleted flag instead of permanently removing records. The implementation enables safe deletion and restoration of discussion content while preserving data integrity and providing moderation capabilities.

Changes:

  • Added soft delete and restore functionality for threads, responses, and comments with audit trail (is_deleted, deleted_at, deleted_by fields)
  • Implemented new API endpoints for restoring individual content and bulk restore operations
  • Added support for viewing deleted content via show_deleted query parameter
  • Updated statistics tracking to count deleted content separately
  • Modified all delete operations to track who performed the deletion

Reviewed changes

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

Show a summary per file
File Description
thread.py Core soft delete implementation with restore methods and stats tracking for deleted content
models.py Updated base delete method to accept and pass deleted_by parameter
comment.py Added soft delete fields and restore methods for comments
views.py Added RestoreContent, BulkRestoreUserPosts, and DeletedContentView endpoints
urls.py Registered new restore and deleted content API routes
serializers.py Added serialization for deletion-related fields with privilege-based visibility
forms.py Added show_deleted field and BY_DELETED ordering option
tasks.py Added restore_course_post_for_user async task for bulk operations
test files Updated test expectations to include new deletion-related fields

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

@Alam-2U Alam-2U requested a review from mraman-2U January 14, 2026 09:23
@Alam-2U Alam-2U merged commit 54b5fe9 into release-ulmo Jan 14, 2026
70 checks passed
@Alam-2U Alam-2U deleted the Cosmo2-793 branch January 14, 2026 09:35
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