fix: refactor email template to use for-loop iteration over social records

This commit is contained in:
Nicholas Riegel 2026-05-30 00:13:00 -04:00
parent 3fcbe7cddb
commit 57c06ce7cc

View file

@ -10,50 +10,37 @@
<field name="auto_delete">True</field>
<field name="body_html"><![CDATA[
<div style="font-family: Arial, sans-serif; line-height: 1.6; max-width: 700px;">
<h2>Blog Post Published</h2>
<p><strong>Title:</strong> ${object.blog_post_id.name}</p>
<p><strong>Blog:</strong> ${object.blog_post_id.blog_id.name}</p>
<p><strong>URL:</strong> <a href="https://itsulu.com${object.blog_post_id.website_url}">https://itsulu.com${object.blog_post_id.website_url}</a></p>
<h3>Social Media Posts — Ready to Post</h3>
% if object.blog_post_id.itsulu_social_id:
% set social = object.blog_post_id.itsulu_social_id[0]
% for social in object.blog_post_id.itsulu_social_id:
% if social.twitter_post_a:
<h4>Twitter Post A</h4>
<h4>Twitter</h4>
<p>${social.twitter_post_a}</p>
% endif
% if social.twitter_post_b:
<h4>Twitter Post B</h4>
<h4>Twitter</h4>
<p>${social.twitter_post_b}</p>
% endif
% if social.bluesky_post_a:
<h4>BlueSky Post A</h4>
<h4>BlueSky</h4>
<p>${social.bluesky_post_a}</p>
% endif
% if social.bluesky_post_b:
<h4>BlueSky Post B</h4>
<h4>BlueSky</h4>
<p>${social.bluesky_post_b}</p>
% endif
% if social.mastodon_post:
<h4>Mastodon</h4>
<p>${social.mastodon_post}</p>
% endif
% if social.linkedin_post:
<h4>LinkedIn</h4>
<p>${social.linkedin_post}</p>
% endif
% endif
% endfor
</div>
]]></field>
</record>