Repository navigation
Conversation
🤖 PR Review
🛡️ Security Review✅ No high-severity vulnerabilities detected. 🚦 Auto-approve🙋 Manual review recommended for the following reason(s):
Automated pre-review — human approval still required. |
🟡 Quality review · 4 findings
High-level — No PR description was staged to reconcile against; the refactor (sender module split, provider dispatch, suppression moved to batch delivery) is reasonably scoped at ~800 changed lines, but it adds a second recipient-link URL resolver with a silent fallback and removes the suppression guard from the sender handoff. 💬 4 inline comments on the diff. Reviewed against the |
| }); | ||
|
|
||
| return ( | ||
| this.workspaceDomainsService.buildPublicFunctionBaseUrl({ workspace }) ?? |
There was a problem hiding this comment.
🟡 Nit · High-level · one source of truth
RecipientLinksService adds a second resolver for the recipient-link host next to getUnsubscribeBaseUrl, and it silently falls back to the workspace public URL or SERVER_URL
Before this PR, tracking was skipped when the domain had no active unsubscribe hostname. Now Resend/SES campaigns can carry click and open links on the shared instance host, while their unsubscribe links still come from drivers/utils/get-unsubscribe-base-url.util.ts, which throws in that same case. Use one resolver for both, or keep the strict no-hostname behaviour for non-LOG drivers so tracking and unsubscribe links always agree on the host.
| @@ -87,125 +87,47 @@ export class EmailingDomainSenderService { | |||
|
|
|||
| async sendEmailBatch({ | |||
There was a problem hiding this comment.
🟡 Nit · High-level · engineering architecture
EmailingDomainSenderService.sendEmailBatch no longer enforces suppression at the handoff, which moves an opt-out guarantee from the sender to each caller
sendEmailBatch is now exported through EmailingDomainSenderModule to messaging too, and any future caller that skips MessageSuppressionService.findBlockedRecipientAddresses will mail unsubscribed recipients. Keep the blocked-address filter in the sender (or in CampaignSenderService), so every send path enforces it.
| connectedAccount, | ||
| }: { | ||
| campaignBatch: CampaignBatch; | ||
| connectedAccount: ConnectedAccountEntity; |
There was a problem hiding this comment.
🟡 Nit · Low-level · Narrow object parameters to the fields read
The parameter is typed as the whole ConnectedAccountEntity, but sendBatch only reads provider, workspaceId and handle; it should be Pick<ConnectedAccountEntity, 'provider' | 'workspaceId' | 'handle'>.
| sendKind, | ||
| emailAddresses: recipients.map((recipient) => recipient.email), | ||
| unsubscribeTopicId, | ||
| where: { domain: getDomainFromEmail(from)?.toLowerCase() }, |
There was a problem hiding this comment.
🟡 Nit · Low-level · No silent failures or permissive fallbacks
If getDomainFromEmail(from) returns undefined, the ?. yields { domain: undefined }, which TypeORM drops from the filter, so findOne can return an arbitrary emailing domain in the workspace instead of failing.
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryRoutes campaign batches through
No actionable issues were found. The inspected callers in dependent PR #32388 use the updated APIs. Diagram%%{init: {'theme': 'neutral', 'htmlLabels': false}}%%
flowchart TD
A[Campaign batch job] --> B[Find campaign channel]
B --> C[Prepare content and recipient links]
C --> D[Check suppressions again]
D --> E[Mark blocked recipients skipped]
D --> F[CampaignSenderService]
F --> G[Shared inbox sender]
G --> H[Find workspace domain and check sending status]
H --> I[Email provider]
I --> J[Record results and bill sent emails]
E --> K[Refresh statistics and check completion]
J --> K
Reviews (1) · Last reviewed commit: "Send campaigns through a sender service ..." · Reviewed by Greptile |
Groundwork for sending campaigns from a personal inbox. Nothing changes for users: campaigns still go out from a shared inbox on a verified domain.
Types
Sender. A campaign is sent through the connected account of its channel.
CampaignSenderServiceswitches on the provider; only the shared inbox case exists here.Job data. The domain is found from the campaign's from address, so its id no longer goes through every job.
type PreparedCampaignSend type MaterializeCampaignJobData type MaterializeCampaignChunkJobData type SendCampaignEmailBatchJobData - emailingDomainId: stringUnsubscribed recipients. The batch job skips them before calling the sender, so the separate result type is gone.
findBlockedRecipientAddressesmoves toMessageSuppressionService.- type CampaignBatchSendOutcomeLinks. Unsubscribe and tracking links use the domain's own hostname when it has one, otherwise the workspace's public domain or the server URL. The log driver used in development gets its links from here too.
Modules.
EmailingDomainSenderModuleholds the emailing domain sender, suppression and topic services, so the outbound messaging module no longer imports the whole emailing module.Blast radius