feat: re-enable community creation via COMMUNITY_CREATION_ENABLED env…#811
feat: re-enable community creation via COMMUNITY_CREATION_ENABLED env…#811Matobi98 wants to merge 1 commit into
Conversation
WalkthroughThis PR adds an opt-in feature flag for community creation. A new ChangesCommunity Creation Feature Flag
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Code Review Summary
Verdict: Comment
No blocking issues. I found one small deployment-risk suggestion:
COMMUNITY_CREATION_ENABLEDis checked with a string-exact comparison against'true'. If an operator sets1,TRUE, or another common truthy value, the command will stay disabled silently. Consider normalizing the flag or documenting the accepted value explicitly.
I did not find an automated test covering the registration gate, so adding one would make this safer to change later.
| // const { user } = ctx; | ||
| // await ctx.scene.enter('COMMUNITY_WIZARD_SCENE_ID', { bot, user }); | ||
| // }); | ||
| if (process.env.COMMUNITY_CREATION_ENABLED === 'true') { |
There was a problem hiding this comment.
This gate is string-exact. If an operator sets COMMUNITY_CREATION_ENABLED=1 or TRUE, /community remains disabled silently. Consider normalizing the flag or documenting the accepted value explicitly.
There was a problem hiding this comment.
Looks good to me. I reviewed the current head commit 85bad0a.
The change is small and scoped correctly: the /community command is only registered when COMMUNITY_CREATION_ENABLED === "true", and the existing COMMUNITY_WIZARD_SCENE_ID is already present in bot/modules/community/scenes.ts, so this does not introduce a dangling scene reference. The accompanying .env-sample update also documents the flag clearly for operators.
Checks run:
npm test -- --runInBandcould not run in this environment becausetscis not installed here (sh: 1: tsc: not found)npm run lintcould not run in this environment becauseeslintis not installed here (sh: 1: eslint: not found)
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