core: credit referral invites on first Lite checkout
Applies saved invites during Lite checkout so users who skip the referral page still credit the inviter. Avoids crediting already-active Lite workspaces so rewards stay tied to the first upgrade.
This commit is contained in:
parent
04c46117b9
commit
6a2cd816b7
4 changed files with 35 additions and 22 deletions
|
|
@ -325,6 +325,13 @@ export namespace Referral {
|
|||
.then((rows) => rows.map((row) => row.workspaceID))
|
||||
if (workspaceIDs.length === 0) return
|
||||
|
||||
const activeLite = await tx
|
||||
.select({ id: LiteTable.id })
|
||||
.from(LiteTable)
|
||||
.where(and(inArray(LiteTable.workspaceID, workspaceIDs), isNull(LiteTable.timeDeleted)))
|
||||
.then((rows) => rows[0])
|
||||
if (activeLite) return
|
||||
|
||||
const litePayment = await tx
|
||||
.select({ id: PaymentTable.id })
|
||||
.from(PaymentTable)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue