Skip to content

Novu template still renders "from X to Y" for a reschedule with no new time — dashboard edit needed to finish #1083 #1085

Description

@teetangh

PR #1083 fixes our side of the "rescheduled … from  to" notification, but it cannot finish the job from this repository. The appointment-rescheduled template is managed in the Novu dashboard, not in version control, and it still renders a "from X to Y" sentence unconditionally.

Until someone edits that template, merging #1083 improves one case and leaves another wrong:

  • Auto-confirmed reschedule — previously rendered "from  to" with both values blank. After fix(appointments): gate Manage Timings on commitment, and give group events a real Unschedule #1083 the payload carries both times, so this case renders correctly with no template change.
  • Plain release ("Any time works") — there is no new time, because the whole point is that the slots return to the consultant's queue. The payload now says so explicitly, but the template will still try to render a destination and produce a half-empty sentence.

What changed on our side

AppointmentRescheduledPayload gained an outcome discriminator with three arms, expressed as a union rather than optional fields — so MOVED and PROPOSED cannot be constructed without both timestamps, and the blank-blank payload that caused this bug is now a compile error rather than a runtime surprise.

outcome When Carries
MOVED A consultee proposal auto-confirmed into the consultant's published availability oldDateTime and newDateTime
PROPOSED Times were proposed and are awaiting the other party's answer oldDateTime and newDateTime
RELEASED A plain release with no destination oldDateTime only — newDateTime is absent, not undefined

One workflow id with a payload discriminator is this repository's established idiom; reminderStage on ORG_INVOICE_OVERDUE and kind on OrgPayoutFailedPayload both work this way. No second workflow id was minted, deliberately.

What needs doing in the Novu dashboard

Edit the appointment-rescheduled template to branch on the new field, along the lines of:

{% if payload.outcome == "RELEASED" %}
  {{ payload.consultantName }} released your {{ payload.planTitle }} session
  on {{ payload.oldDateTime }}. You will be notified once a new time is set.
{% else %}
  {{ payload.consultantName }} moved your {{ payload.planTitle }} session
  from {{ payload.oldDateTime }} to {{ payload.newDateTime }}.
{% endif %}

The exact copy is a product decision; the branch is the requirement.

Related, and worth fixing at the same time

The audit that came out of #1083 found this is a pattern rather than a one-off — optional payload fields declared and never passed by any caller. Two remain open:

Any template reading those fields is rendering a blank today.

Verification note

None of this has been seen in a browser. #1083's payload behaviour is unit-tested — including that a plain release carries no newDateTime key at all — but the rendered notification has not been observed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions