Trigger with article.body variable displays ">" at start of every line

using zammad 3.2.
I’m using a trigger to send an email notification when a ticket is updated. The trigger is configured to use the #{article.body} variable to display the text of the update in the email notification.
When reading the actual email as a result, every line within the article text is prefixed by “>”.
Is this normal? Can this be changed? I’m not sure why this happens.

I do agree, that’s unexpected.
I could swear that this was different earlier, but because of the many results when I was searching for the responsible code, I am unsure where it really comes from. Personally I think it comes from zammad/lib/notification_factory/renderer.rb, but still not sure.

Maybe @thorsteneckel could have a look where it comes from and if it’s intendet.

Any way, while I was testing this, you might want to use article.body_as_html instead, as it does no quoting as of now. Can’t provide any good solutions if you want text only.

ok got it, thanks. Yes i switched to body_as_html for now.

@MrGeneration @thorsteneckel

Maybe zammad/lib/notification_factory/renderer.rb, lines 47 to 53?

# aliases
map = {
  'article.body' => 'article.body_as_text_with_quote.text2html',
}
if map[key]
  key = map[key]
end

Looks like body_as_text_with_quote is responsible. body_as_text works as intended by @JayST.

I’d recommend defaulting to body_as_text when using #{article.body} and introducing #{article.body_with_quote} for the current behaviour.

@MrGeneration Found, corrected and tested it. Seems like there wasn’t a different behaviour on the text only version…

I’d love to create a PR—so only one question remains:

Would you like #{article.body} to keep the “>” in front (for ‘backwards compatibility’) or would you rather follow my recommendation?

Just a small follow up.
We internally came up for the following approach and created an enhancement issue for this:

We do not have a roadmap / ETA for this, but we got it on our list now.

1 Like

Thank you very much for the detailed description/explanation :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.