Repository navigation
Conversation
Fixes OpenSignLabs#2268 Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
|
@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. |
There was a problem hiding this comment.
🟡 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); |
4 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
The "automatic reminders" option was dead:
NextReminderDatewas calculated andstored on the document, but nothing ever read it, so no reminder was ever sent.
Affected files
apps/OpenSignServer/index.jsFix
An hourly scheduler runs on the server. It selects the non-completed,
non-declined, non-archived documents whose
NextReminderDateis due, sends thereminder, and advances
NextReminderDatebyRemindOnceInEverydays. Thereminder stops when the document expires or is completed.
Acceptance criteria
NextReminderDatetriggers a reminderNextReminderDateadvances byRemindOnceInEveryafter each reminder