Add recipient email and milestone notifications on transfer create.
Deploy Ladill Transfer / deploy (push) Successful in 44s

Recipients can be emailed the download link immediately and at optional
reminders (7/3/1 days before unavailable, or when grace period starts).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 12:38:58 +00:00
co-authored by Cursor
parent 311b5b40bb
commit 7c4673adb6
15 changed files with 851 additions and 5 deletions
+25
View File
@@ -23,6 +23,9 @@ class Transfer extends Model
'qr_code_id',
'title',
'message',
'recipient_email',
'recipient_email_milestones',
'recipient_milestones_sent',
'password_hash',
'retention_days',
'expires_at',
@@ -40,6 +43,8 @@ class Transfer extends Model
'paid_until' => 'datetime',
'grace_ends_at' => 'datetime',
'last_billed_at' => 'datetime',
'recipient_email_milestones' => 'array',
'recipient_milestones_sent' => 'array',
'downloads_total' => 'integer',
'storage_bytes' => 'integer',
];
@@ -149,4 +154,24 @@ class Transfer extends Model
->orWhere('grace_ends_at', '>', now());
});
}
public function wantsRecipientMilestone(string $milestone): bool
{
return in_array($milestone, (array) ($this->recipient_email_milestones ?? []), true);
}
public function recipientMilestoneSent(string $milestone): bool
{
return in_array($milestone, (array) ($this->recipient_milestones_sent ?? []), true);
}
public function markRecipientMilestoneSent(string $milestone): void
{
$sent = (array) ($this->recipient_milestones_sent ?? []);
$sent[] = $milestone;
$this->forceFill([
'recipient_milestones_sent' => array_values(array_unique($sent)),
])->save();
}
}