Skip to content

Conversation

@mraman-2U
Copy link
Member

This pull request introduces a new Django admin interface and database migration to support discussion moderation features, including user bans, ban exceptions, and moderation audit logs. The changes add three new models—DiscussionBan, DiscussionBanException, and DiscussionModerationLog—with corresponding admin configurations that enforce strict permissions and auditability. These updates are designed to improve moderation workflows and compliance in discussion forums.

Discussion Moderation Models and Admin Interfaces:

  • Added new models: DiscussionBan, DiscussionBanException, and DiscussionModerationLog to represent user bans, exceptions to bans, and audit logs for moderation actions. The models include fields for user references, course or organization scope, reasons, timestamps, and moderator info.
  • Enforced unique constraints and indexes to ensure data integrity and efficient queries, such as unique active bans per user and course/org, and unique exceptions per ban and course.

Django Admin Permissions and Usability:

  • Implemented admin interfaces for each model with a ReadOnlyForNonSuperuserMixin, making the admin read-only for staff (view-only for audit/support) and full-access only for superusers. The moderation log admin is strictly read-only for all users, even superusers, to maintain audit integrity.
  • Enhanced admin usability with list displays, filters, search fields, and fieldsets for each model. Added user-friendly features such as clickable links to related users and bans, and truncated reason previews for readability.

Migration and Schema Management:

  • Created an initial migration to set up the new tables, indexes, and constraints in the database, ensuring the new moderation features are integrated into the platform's schema.

@mraman-2U mraman-2U marked this pull request as ready for review December 2, 2025 10:10
Copy link

@chintanjoshi-apphelix-2u chintanjoshi-apphelix-2u left a comment

Choose a reason for hiding this comment

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

I am still going through the files,

but initially we can move the models and logic to forum repository, if possible.

@mraman-2U
Copy link
Member Author

I am still going through the files,

but initially we can move the models and logic to forum repository, if possible.

In discussions, models are managed in the following 2 locations

  1. django_comments_common - Application infrastructure models such as Role, Permission and courese settings/config
  2. forums repo - Content models with storage logic to either MySQL or Mongodb.

The new moderation model:

  1. Feature specific model with namespace discussion_*
  2. Not depend on content storage of either MySQL or Mongodb, backend agnostic
  3. Require LMS dependencies such as CourseKeyField, CourseStaffRole etc.

Let me know your thoughts on the new feature specific model approach

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