Skip to content

Commit

Permalink
Add default signature for plain-text campaigns
Browse files Browse the repository at this point in the history
  • Loading branch information
wmnnd committed Dec 21, 2024
1 parent 4e9dca7 commit dbdef3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/keila/mailings/builder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ defmodule Keila.Mailings.Builder do
defp put_body(email, campaign = %{settings: %{type: :text}}, assigns) do
body_with_signature =
(campaign.text_body || "") <>
"\n\n-- \n" <> (assigns["signature"] || HybridTemplate.signature())
"\n\n-- \n" <> (assigns["signature"] || HybridTemplate.text_signature())

case render_liquid(body_with_signature, assigns) do
{:ok, text_body} ->
Expand Down
11 changes: 11 additions & 0 deletions lib/keila/templates/hybrid_template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ defmodule Keila.Templates.HybridTemplate do
Powered by [Keila - OpenSource Newsletters](https://www.keila.io/)
"""

@text_signature """
Unsubscribe:
{{ unsubscribe_link }}
This newsletter is powered by Keila: https://www.keila.io
"""

@spec styles() :: Keila.Templates.Css.t()
def styles() do
@styles
Expand Down Expand Up @@ -130,4 +137,8 @@ defmodule Keila.Templates.HybridTemplate do
def signature() do
@signature
end

def text_signature() do
@text_signature
end
end

0 comments on commit dbdef3a

Please sign in to comment.