Mei
Mei
NNovu
Created by Mei on 2/23/2024 in #💬│support
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
{{#unless step.digest}}
nondigest stuff with {{payload_property}}
{{else}}
{{#equals step.total_count 1}}
nondigest stuff with {{payload_property}} <- duplicated!!
{{#else}}
digest stuff with {{#each step.events}}{{payload_property}}{{/each}}
{{/equals}}
{{/unless}}
{{#unless step.digest}}
nondigest stuff with {{payload_property}}
{{else}}
{{#equals step.total_count 1}}
nondigest stuff with {{payload_property}} <- duplicated!!
{{#else}}
digest stuff with {{#each step.events}}{{payload_property}}{{/each}}
{{/equals}}
{{/unless}}
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
10 replies
NNovu
Created by Mei on 2/18/2024 in #💬│support
Digest templates with 1 event total
It appears that digests that end up having only one trigger by the time they expire still pass step.digest and step.events to templates. Is there a suggested way to have a template still render a single-event branch in this case? I don’t think I can do an equality check of step.events.length and 1 inside the handlebars template, can I?
6 replies
NNovu
Created by Mei on 11/29/2023 in #💬│support
Prebuilt container versions question
The gh container registry has images tagged for what seems to be every commit, plus the 0.21.0 tag, plus latest, prod and dev. Is the build process for these images meaningfully different? I.e. is an image to be tagged with a version number built differently to the other images, or is it just that the images with a version number are built for commits where the project is in a stable state intended for release? I ask, because locally in a dev environment I have been testing the dev-tagged image for novu/worker because I am interested in testing out the newly-implemented template parsing inside filters, and I’m encountering weird behaviour there (regarding digests with filters) that aren’t present with the prod and 0.21.0 images. I don’t know whether this is a result of those images only being meant for internal development of novu or if the next branch has a newly-introduced bug that I should report.
7 replies