Community creation env var#809
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR introduces community enable/disable state management. A new ChangesCommunity Enable/Disable Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The change introduces a single, well-defined feature (community enable/disable) applied consistently across the codebase. Logic density is moderate: state guard logic in enable/disable commands, filtering pattern repeated across queries (homogeneous), and straightforward localization additions. No complex interdependencies or ambiguous behavior transitions. Reviewers should verify filtering consistency across all query sites and validate Telegram notification error handling. Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bot/modules/community/commands.ts`:
- Around line 269-270: The validateObjectId check must short-circuit so we don't
later send duplicate "community_not_found" replies: ensure the helper that does
"if (!(await validateObjectId(ctx, input))) return null;" (the call that
precedes "return Community.findOne({ _id: input });") returns null on invalid
IDs and update the caller code paths that handle its result to bail out
immediately when they receive null instead of falling through to the existing
community_not_found reply; remove or gate the redundant replies that send
"community_not_found" (the blocks referenced around the current duplicate
checks) so only one response is sent for an invalid/community-missing ID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a0b39147-8f44-4c52-9444-e09eebc65295
📒 Files selected for processing (19)
.env-samplebot/modules/community/actions.tsbot/modules/community/commands.tsbot/modules/community/index.tsbot/modules/community/messages.tsbot/modules/orders/scenes.tsbot/modules/user/scenes/settings.tslocales/de.yamllocales/en.yamllocales/es.yamllocales/fa.yamllocales/fr.yamllocales/it.yamllocales/ko.yamllocales/pt.yamllocales/ru.yamllocales/uk.yamlmodels/community.tsutil/communityHelper.ts
|
This pr looks like a continuation of #807 |
Summary
COMMUNITY_CREATION_ENABLEDenvironment variable (default:false) that controls whether the/communitycommand is registered at bot startup/communitycommand block inbot/modules/community/index.tswith a conditionalregistration guarded by the env var
COMMUNITY_CREATION_ENABLED=falseto.env-samplewith an explanatory commentBehavior
COMMUNITY_CREATION_ENABLED=false(default) —/communityis not registered; community creation is disabledCOMMUNITY_CREATION_ENABLED=true—/communityis registered and users can create communities through the existingwizard flow
The wizard scene itself (
COMMUNITY_WIZARD_SCENE_ID) is unchanged — it was already fully implemented.Test plan
COMMUNITY_CREATION_ENABLEDunset orfalse, confirm/communityreturns no response / unknown commandCOMMUNITY_CREATION_ENABLED=true, confirm/communityenters the community creation wizard correctlyEOF
Summary by CodeRabbit
New Features
Documentation
Chores