Conversation
…s and use factories for tests
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.
Add chat eligibility check dry run
Description
This pull request introduces a "dry run" functionality for the chat management system, which allows community managers to check user compliance against chat rules without actually removing/kicking any users. It also refactors
AuthorizationAction.evaluate_chat_members_eligibilityso that it doesn't implicitly hide unmanaged users, purely focusing on calculating rules eligibility.Checklist
Before submitting your pull request, please ensure the following:
Changes
is_managedandis_full_controlchat member filtering into the caller, refactoringAuthorizationActionintoevaluate_chat_members_eligibility. It now simply processes whoever is passed to it and returns explicitChatMemberEligibilityResultDTOobjects.check_chat_members_compliance_dry_runtoCommunityManagerUserChatAction. It logs rule evaluation summaries for all valid server members (managed and non-managed), outputting a summary at the end.is_managedtoggling directly inCommunityManagerUserChatAction.kick_ineligible_chat_members. If a previously unmanaged user passes an eligibility check in a full-control chat, they forcefully become managed (is_managed = True).POST /admin/chat/manage/{slug}/control-dry-runendpoint wired to a new Celery taskcheck-target-chat-members-dry-runwith a 5-minute Redis-based rate limit cooldown.community_managermodule to usetest.factories(e.g.,TelegramChatUserFactory.with_session(db_session).create(...)) for predictable and robust DB states. Added tests covering the dry-run counting mechanics and theis_managedtoggle tagging logic.How Has This Been Tested?
We tested these changes against the existing suite using the dockerized backend environment.
Thank you for contributing! 🎉