feat(notifications): carry what people wrote into the notification an… - #36
Merged
Merged
Conversation
…d the email
The comments an employee, manager or HR leave on a request are the substance of
the workflow — the reason for asking, the reason for refusing, the question that
holds a decision up — and until now almost none of it left the database. A
comment produced no notification and no email at all, so it existed only behind
the request's Comments tab, which nobody opens unless they already know there is
something to read. A manager's question could sit unanswered until the request
escalated on a timer.
Adding a comment now notifies and mails the other people on the request: the
employee and their line manager, plus HR once the request has been escalated and
they are a party to it. The author is never notified of their own comment.
The same text is now carried by the messages that already existed, attributed to
whoever wrote it:
- new request / escalation / reminder — the applicant's reason, which the
manager was previously asked to decide without;
- approved — the manager's approval note, which was dropped entirely;
- rejected — the reason, which reached the email only, glued into the middle of
the summary sentence, and never the notification;
- withdrawal declined — the refusal reason, in place of the previous
"See the comments on the request for the reason."
The email quotes the text in full via addBodyListItem, which escapes it and keeps
its line breaks, so a comment written as several paragraphs still reads as
several paragraphs. A notification renders on one line and its parameters are
copied to every recipient's row, so it carries a whitespace-collapsed 200-char
opening instead; where a note is present it replaces the message boilerplate,
because "Review it in Absence." says nothing the Review button does not while the
reason is the reason to look at all.
The replacement is the one deliberate exception: they are told the dates and
nothing else. Cover duty does not come with a right to read a reason that may be
medical, and a test pins that.
Notifications stored before this change have neither parameter, so the notifier
reads both defensively rather than failing to parse an old row.
For the server log, comment bodies and decision comments were already there as
`detail`. The gap was the applicant's own reason, which was never logged at all;
it now goes into the request_created context as `reason`. Deliberately not into
`detail` — that feeds the per-request history timeline, where the Details tab
already shows the reason and a second copy would just be noise.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
…d the email
The comments an employee, manager or HR leave on a request are the substance of the workflow — the reason for asking, the reason for refusing, the question that holds a decision up — and until now almost none of it left the database. A comment produced no notification and no email at all, so it existed only behind the request's Comments tab, which nobody opens unless they already know there is something to read. A manager's question could sit unanswered until the request escalated on a timer.
Adding a comment now notifies and mails the other people on the request: the employee and their line manager, plus HR once the request has been escalated and they are a party to it. The author is never notified of their own comment.
The same text is now carried by the messages that already existed, attributed to whoever wrote it:
The email quotes the text in full via addBodyListItem, which escapes it and keeps its line breaks, so a comment written as several paragraphs still reads as several paragraphs. A notification renders on one line and its parameters are copied to every recipient's row, so it carries a whitespace-collapsed 200-char opening instead; where a note is present it replaces the message boilerplate, because "Review it in Absence." says nothing the Review button does not while the reason is the reason to look at all.
The replacement is the one deliberate exception: they are told the dates and nothing else. Cover duty does not come with a right to read a reason that may be medical, and a test pins that.
Notifications stored before this change have neither parameter, so the notifier reads both defensively rather than failing to parse an old row.
For the server log, comment bodies and decision comments were already there as
detail. The gap was the applicant's own reason, which was never logged at all; it now goes into the request_created context asreason. Deliberately not intodetail— that feeds the per-request history timeline, where the Details tab already shows the reason and a second copy would just be noise.🤖 AI (if applicable)