Discussion: Handlebars helper for digest/non digest
We allow our subscribers to decide whether or not they want digests enabled by putting a filter based on subscriber data on our digest steps.
The problem is that taking into account all the states in which a digest with a filter could leave the Handlebars template variables (no step.events, step.events but step.events.length = 1, and step.events.length > 1) results in a very janky template like the below
I think Novu should provide a Handlebars helper to abstract away the two required unless+equals branches so that the user does not need to duplicate the part of the template intended for non-digest/digests with a single event. I’m willing to write a PR to implement such a helper but thought I should discuss it here before opening an issue
6 Replies
(For complete transparency, a bug in Novu currently prevents a filter on subscriber on a digest step from ever actually passing but the above problem will still be felt for any type of filter on a digest. We’re running a patched version of Novu and I have a GitHub issue waiting to be assigned to me to have that fix pulled upstream. The patches we have should not impact this templating issue)
@Mei can you link the PR?
No PR yet since I've not been assigned the issue and the contribution guidelines are pretty explicit about that
I can link the issue though https://github.com/novuhq/novu/issues/5163,
and the PR would be just this one change https://github.com/novuhq/novu/commit/9a3de53776fb707dff1febeea97de442aee376e4
@Zac Clifton
I can assign it, if you want to create the pr, I can approve
Thanks @Mei for the PR
I requested review from Gali