Skip to content

Skip partner commission emails under $10 - #4781

Closed
Joker666 wants to merge 1 commit into
mainfrom
commission-email-minimum
Closed

Joker666 wants to merge 1 commit into
mainfrom
commission-email-minimum

Conversation

@Joker666

@Joker666 Joker666 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

Fixes https://linear.app/dubinc/issue/ENG-1918/skip-partner-commission-emails-under-dollar10

  • Send the partner "new commission" email only when the commission earnings are $10 or more.
  • Skip the partner and link queries when no email will go out.
  • The workspace owner email for the first sale does not change.

Motivation

Partners got an email for every new commission, also for very small ones. Partners with many small commissions got a lot of email noise.

How to test

  1. Run the app locally with a seeded program, and turn on the "commission created" notification for a partner user.
  2. Create a sale commission with earnings under $10 for that partner. No partner email is sent.
  3. Create a sale commission with earnings of $10 or more. The partner gets the "You've made a ... commission" email.
  4. Create the first sale for a new partner and customer pair with earnings under $10. The workspace owner still gets the "New sale referred by ..." email.

Summary by CodeRabbit

  • Bug Fixes
    • Partner commission emails are now sent only when earnings reach at least $10. This prevents email notifications for commissions below that amount. Program-owner notifications remain limited to a partner’s first sale commission for a customer, so repeat commissions do not trigger those notifications. When no notification is eligible, no notification is sent.

Partners now get the new commission email only when the earnings are
$10 or more. The workspace owner email for the first sale is unchanged.
@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dub Ready Ready Preview Oct 25, 2026 2:41am UTC

Request Review

@linear

linear Bot commented Oct 25, 2026

Copy link
Copy Markdown

ENG-1918

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bec0c09d-19ee-46d5-b738-4f99a266477c
Commits

Reviewing files that changed from the base of the PR and between f949c06 and 6c2d992.

Files selected for processing: 1
  • apps/web/lib/api/partners/notify-partner-commission.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Partner commission notifications now require earnings of at least 1,000 cents. Program-owner notifications remain limited to sale commissions that are the partner’s first commission for the customer. The function skips later lookups when neither condition applies.

Changes: Partner commission notifications

Layer / File(s) Summary
Notification eligibility and recipients
apps/web/lib/api/partners/notify-partner-commission.ts
Partner email recipients are collected only when earnings meet the 1,000-cent threshold. If neither the earnings threshold nor the existing first-sale condition applies, the function returns before fetching notification recipients and link data.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: steven-tey

Merge Risk: Minimal · up to 6c2d9

The change matches the stated notification behavior and is ready to merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: partner commission emails are skipped for commissions below $10.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch was successfully deployed

1 active deployment
Preview — 6c2d9923 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants