Ganchos para personalização de emails de digest e notificações

I have a client who would like to include ads in summary and notification emails. I’ve “crafted” a plugin that allows adding some text to the digest email (which I think needs some updating to catch up with changes made to that template).

I don’t like that I have to override the entire template to customize those emails.

Would it be possible to include a way to add to those emails without overriding the template?

The plugin works by having taking a topic ID in a custom field and including raw of the last post in the topic as the text added to the email (just before or after the header). Though I think it’s a pretty clever hack, that seems a bit too fiddly a solution to suggest adding to core. Perhaps there’s a way to have the Ad plugin be able to apply house ads to the digest and summary emails?

Managing a fragile plugin

Maybe I should write a spec that compares the digest email with the plugin off with the digest email with the plugin on but not configured to add anything to the email? Then I’d catch changes to the core template?

6 curtidas

Olá Jay

Este plugin “funciona” com o Discourse 3.1? Ou pelo menos vale a pena testar?

Você pode tentar. Acho que não ouço falar deles desde essa mensagem, então imagino que eles não tenham atualizado desde então.

Você pode me avisar se estiver quebrado. Provavelmente não terei tempo de consertar de graça, mas talvez eu consiga.

2 curtidas

Pelo que entendi, digest_custom_html e digest_custom_text já implementam hooks para digest.html.erb e digest.text.erb. Portanto, uma implementação básica dessa solicitação envolveria a adição de mais desses hooks?

Uma implementação mais avançada poderia fornecer sub-templates, que poderiam ser usados para fornecer aos autores de plugins código de estilo e formatação mantido pelo Discourse.

Entendi corretamente que sua implementação seria possível com um digest_custom_html("before_preheader") adicionado a digest.html.erb?

Eu acho que sim. Não olho atentamente como funciona há anos.

Olá @thoka, você conseguiu implementar algo através desses hooks? Atualmente, estamos procurando injetar alguns segmentos patrocinados simples através desses hooks.

Eu fiz isso. Desde que você gere suas injeções com html_safe, você estará em boa situação.

Há uma discussão em Fixing digest_custom_html to be treated as HTML (was: Overriding digest.html.erb)

2 curtidas