Changed member welcome email job to run based on config#16
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| } | ||
|
|
||
| if (!hasScheduled.processOutbox && !process.env.NODE_ENV.startsWith('test')) { | ||
| if (hasScheduled.processOutbox && !process.env.NODE_ENV.startsWith('test')) { |
There was a problem hiding this comment.
Inverted condition prevents job from being scheduled
High Severity
The condition was changed from !hasScheduled.processOutbox to hasScheduled.processOutbox, inverting the logic. Since hasScheduled.processOutbox is initialized to false, the condition hasScheduled.processOutbox && ... is always false, so jobsService.addJob() is never called and the welcome email processing job is never scheduled.
| if (this._labsService.isSet('welcomeEmails') && WELCOME_EMAIL_SOURCES.includes(source)) { | ||
| var member; | ||
| const welcomeEmailConfig = config.get('memberWelcomeEmailTestInbox'); | ||
| if (welcomeEmailConfig || WELCOME_EMAIL_SOURCES.includes(source)) { |
There was a problem hiding this comment.
Wrong operator breaks source filtering for outbox entries
High Severity
The condition was changed from && to ||, breaking source filtering. The original logic required BOTH the feature flag AND an allowed source. With ||, when welcomeEmailConfig is truthy, outbox entries are created for ALL member sources (including import, admin, api) instead of only the 'member' source, contradicting the test expectations.
Benchmark PR from qodo-benchmark#246
Note
Shifts welcome email gating from a labs flag to a config key and aligns outbox/job behavior and tests.
labs.isSet('welcomeEmails')withconfig.get('memberWelcomeEmailTestInbox')inMemberRepository.createand the welcome email job schedulerMemberCreatedEventnow added when config is set or when source ismember; skipped if config is unset or source is disallowed (import,admin,api)process-member-welcome-emailsevery 5 minutes only when the config key is present and not running testsconfigUtilsandconfig.getstubs, asserting new conditions and payloads (timestamp, source)Written by Cursor Bugbot for commit 96cac63. Configure here.