feat: bulkdelete ban forum #8
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive support for discussion bans and moderation audit logging in the forum app, including new models, API functions, and migration logic. The main changes are the addition of models for banning users from discussions at both course and organization levels, mechanisms for ban exceptions, and detailed logging of moderation actions. These updates are reflected in both the Django models and the MongoDB backend, along with a migration to set the default source of moderation audit logs to 'ai'.
Discussion Ban and Moderation Models:
DiscussionBan,DiscussionBanException, andDiscussionModerationLogto support course-level and organization-level bans, ban exceptions, and audit logs of moderation actions. Includes constraints, indexes, and denormalized fields for efficient querying.API Functions for Ban Management:
forum/api/bans.pyfor banning users (ban_user), unbanning users (unban_user), retrieving banned users (get_banned_users), and fetching individual bans (get_ban). These handle both course and org scopes, exceptions, and audit logging.MongoDB Backend Integration:
DiscussionBanExceptions,DiscussionBans,DiscussionModerationLogs) in the MongoDB backend for use in non-relational contexts. [1] [2]Migration and Audit Log Updates:
sourcefield inModerationAuditLogto 'ai'. The migration also populates existing records with the new default and provides a reversible operation.Check off if complete or not applicable: