ダイジェストと通知メールのカスタマイズ用フック

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

ジェイさん

このプラグインはDiscourse 3.1で「動作」しますか?それともテストする価値はありますか?

試してみて。このメッセージ以降、彼らから何も聞いていないので、それ以来アップグレードしていないと推測します。

壊れている場合は教えてください。無料では直す時間がないかもしれませんが、直せるかもしれません。

「いいね!」 2

私の理解では、digest_custom_htmldigest_custom_text はすでに digest.html.erb および digest.text.erb のフックを実装しています。したがって、このリクエストの基本的な実装は、これらのフックをさらに追加することになるのでしょうか?

より高度な実装では、サブテンプレートを提供でき、これによりプラグイン作成者は Discourse によって管理されるスタイルとフォーマットのコードを提供できます。

あなたの実装は、digest.html.erbdigest_custom_html("before_preheader") を追加することで可能になると理解していますか?

そう思います。何年もその仕組みを詳しく見ていません。

@thokaさん、フック経由で何か実装できましたか?現在、これらのフックを介して簡単なスポンサーセグメントを挿入することを検討しています。

それを実行しました。html_safe を使用してインジェクションを生成する限り、問題ありません。

Fixing digest_custom_html to be treated as HTML (was: Overriding digest.html.erb) で議論が行われています。

「いいね!」 2