Tenant Portal Invite Auto-Send on Deposit Release Proposal
Tenant Portal Invite Auto-Send on Deposit Release Proposal
Overview
As of v0.1.332, when a deposit release is proposed the platform automatically checks whether the primary tenant holds an active portal invite. If they do not — because the invite was never sent, was manually revoked, or has expired — a fresh invite is generated and delivered in the same notification email as the deposit release proposal.
This removes the dependency on the periodic invite-expiry sweep (tenant-portal-invite-expiry-sweep) for this specific scenario and ensures tenants can always act on a proposed release immediately.
How It Works
Previous Behaviour
Deposit release proposed
│
▼
Proposal notification sent ──► Tenant may have no active portal invite
(invite expired or never sent)
→ Tenant cannot access portal to respond
New Behaviour
Deposit release proposed
│
▼
Proposal notification triggered
│
├─► Check: does primary tenant have an active portal invite?
│ │
│ YES └──► Use existing invite ─┐
│ │ │
│ NO └──► Generate new token ──┤
│ │
▼ ▼
Single notification email sent ◄──────────┘
(includes portal invite link)
Steps in Detail
- Proposal notification is triggered — A landlord or agent proposes a deposit release, which fires the
deposit-release-proposed-notifyInngest function. - Active invite check — The function queries the primary tenant's portal invite record and evaluates whether it is present and non-expired.
- Conditional token generation — If the invite is missing or expired, a new invite token is created using the same mechanism as the manual invite flow.
- Atomic email delivery — The proposal notification email is assembled with the portal invite link included, then dispatched as a single send. There is no separate invite email.
Affected Files
| File | Change |
|---|---|
src/inngest/functions/deposit-release-proposed-notify.ts | Post-notification logic added to check invite status and auto-generate a fresh invite token when needed |
Edge Cases
| Scenario | Behaviour |
|---|---|
| Tenant already has an active invite | Existing invite link is reused; no new token generated |
| Tenant invite has expired | New token generated and included in the proposal email |
| Tenant has never received an invite | New token generated and included in the proposal email |
| Multiple tenants on the tenancy | Only the primary tenant is checked and targeted |
Related Components
tenant-portal-invite-expiry-sweep.ts— Periodic sweep that handles invite expiry across all tenancies. This sweep continues to operate independently; the new auto-send logic is additive and does not replace it.deposit-release-proposed-notify.ts— Core notification function, now extended with the invite check-and-generate step.
Compliance Note
Under the Renters' Rights Act, tenants must be given a clear opportunity to review and respond to any proposed deposit deductions or releases. Ensuring tenants always have portal access at the moment a release is proposed directly supports this requirement by removing a class of cases where a tenant could be notified but practically unable to respond.