Closed
Conversation
b26e61c to
37da952
Compare
2454d91 to
0cb0c47
Compare
- Remove trailing whitespace from forum/api/bans.py and forum/views/bans.py - Break long lines to meet 120 character limit - Add mypy ignore_errors for ban-related modules (type annotations needed)
This reverts commit 9f0b0f5.
f42440f to
1ef3369
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: