Skip to content

feat(reminders): dispatch reminders from a scheduler (#2268) - #2306

Open
alfonsodg wants to merge 1 commit into
OpenSignLabs:stagingfrom
alfonsodg:pr/2268-reminders
Open

alfonsodg wants to merge 1 commit into
OpenSignLabs:stagingfrom
alfonsodg:pr/2268-reminders

Conversation

@alfonsodg

Copy link
Copy Markdown

Problem

The "automatic reminders" option was dead: NextReminderDate was calculated and
stored on the document, but nothing ever read it, so no reminder was ever sent.

Affected files

  • apps/OpenSignServer/index.js

Fix

An hourly scheduler runs on the server. It selects the non-completed,
non-declined, non-archived documents whose NextReminderDate is due, sends the
reminder, and advances NextReminderDate by RemindOnceInEvery days. The
reminder stops when the document expires or is completed.

Acceptance criteria

  • A document with a due NextReminderDate triggers a reminder
  • NextReminderDate advances by RemindOnceInEvery after each reminder
  • No reminder is sent for completed, declined, archived or expired documents

Fixes OpenSignLabs#2268

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 22:40
@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@alfonsodg is attempting to deploy a commit to the prafull 's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Recipient selection and scheduling behavior can leave pending signers unnotified or produce reminders at unintended times.

4 open issues
What changed in this PR

Adds a server-side scheduler to activate automatic reminders using the document reminder dates already stored by OpenSign.

Changes:

  • Runs reminder processing shortly after startup and then hourly.
  • Selects due documents, excluding completed, declined, and archived records, and checks expiry before dispatch.
  • Advances reminder dates or disables reminders when the next date exceeds expiry.
File Description
apps/​OpenSignServer/​index.js Adds scheduled reminder queries, email dispatch, and reminder-date updates.

Review effort: Balanced

q.notEqualTo('IsCompleted', true);
q.notEqualTo('IsDeclined', true);
q.notEqualTo('IsArchive', true);
q.lessThanOrEqualTo('NextReminderDate', now);
Comment on lines +287 to +288
q.limit(100);
const docs = await q.find({ useMasterKey: true });
Comment on lines +297 to +303
const creator = doc.get('ExtUserPtr');
const creatorEmail = creator?.get?.('Email') || doc.get('SenderMail');
const pdfName = doc.get('Name') || 'Document';
if (creatorEmail) {
await Parse.Cloud.sendEmail({
sender: `${appName} <${process.env.SMTP_USER_EMAIL || process.env.MAILGUN_SENDER || ''}>`,
recipient: creatorEmail,
});
}
const every = doc.get('RemindOnceInEvery') || 5;
const next = new Date(doc.get('NextReminderDate') || now);
@alfonsodg alfonsodg changed the title feat(reminders): dispatch the automatic reminders from a scheduler (#2268) feat(reminders): dispatch reminders from a scheduler (#2268) Oct 22, 2026

This branch has not been deployed

No deployments
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