-
Notifications
You must be signed in to change notification settings - Fork 1
Changed member welcome email job to run based on config #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: qodo_full_base_changed_member_welcome_email_job_to_run_based_on_config_pr6
Are you sure you want to change the base?
Changes from all commits
120efae
2ac7b59
3fedc84
f2429b3
bc7e716
bde2541
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ const ObjectId = require('bson-objectid').default; | |
| const {NotFoundError} = require('@tryghost/errors'); | ||
| const validator = require('@tryghost/validator'); | ||
| const crypto = require('crypto'); | ||
| const config = require('../../../../../shared/config'); | ||
|
|
||
| const messages = { | ||
| noStripeConnection: 'Cannot {action} without a Stripe Connection', | ||
|
|
@@ -336,8 +337,9 @@ module.exports = class MemberRepository { | |
| const eventData = _.pick(data, ['created_at']); | ||
|
|
||
| const memberAddOptions = {...(options || {}), withRelated}; | ||
| let member; | ||
| if (this._labsService.isSet('welcomeEmails') && WELCOME_EMAIL_SOURCES.includes(source)) { | ||
| var member; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. var member declaration used • New code declares member with var, which violates the requirement to use block-scoped let/const. • This increases the risk of hoisting/scope-related bugs and makes the variable’s lifetime harder to reason about. Agent prompt
|
||
| const welcomeEmailConfig = config.get('memberWelcomeEmailTestInbox'); | ||
| if (welcomeEmailConfig || WELCOME_EMAIL_SOURCES.includes(source)) { | ||
|
Comment on lines
+341
to
+342
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Config check uses wrong or • The new condition if (welcomeEmailConfig || WELCOME_EMAIL_SOURCES.includes(source)) will evaluate true for source === 'member' even when the config is unset/undefined. • This fails to handle the “config not set” edge case, potentially creating outbox entries (and sending welcome emails) when the feature should be disabled. Agent prompt
|
||
| const runMemberCreation = async (transacting) => { | ||
| const newMember = await this._Member.add({ | ||
| ...memberData, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Job never scheduled
🐞 Bug✓ CorrectnessAgent prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools