Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watermark in email template #108

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/notification/email_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@

class EmailSender(ISender):
highlight_tags = ("<span class='highlight' style='background:#FFA;'>", "</span>")

def __init__(self, specs) -> None:
self.specs = specs
self.watermark = """
<p><small>Esta pesquisa foi realizada automaticamente pelo
<a href="https://gestaogovbr.github.io/Ro-dou/">Ro-DOU</a>
</small>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</small>
</small></p>

Fechar a tag <p> é opcional. Mas para ficar consistente com a forma como é usado o resto do conteúdo, acho que é bom ter, não?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não gostou da sugestão, @washolive ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fiz em outro PR #109

"""

def send(self, search_report: list, report_date: str):
"""Builds the email content, the CSV if applies, and send it"""
Expand All @@ -41,6 +45,8 @@ def send(self, search_report: list, report_date: str):
else:
content = self.generate_email_content()

content += self.watermark

if self.specs.attach_csv and skip_notification is False:
with self.get_csv_tempfile() as csv_file:
send_email(
Expand Down Expand Up @@ -111,10 +117,10 @@ def generate_email_content(self) -> str:
if not self.specs.hide_filters:
sec_desc = item["section"]
item_html = f"""
<p class="secao-marker">{sec_desc}</p>
### [{item['title']}]({item['href']})
<p style='text-align:justify' class='abstract-marker'>{item['abstract']}</p>
<p class='date-marker'>{item['date']}</p>"""
<p class="secao-marker">{sec_desc}</p>
### [{item['title']}]({item['href']})
<p style='text-align:justify' class='abstract-marker'>{item['abstract']}</p>
<p class='date-marker'>{item['date']}</p>"""
blocks.append(
textwrap.indent(textwrap.dedent(item_html), " " * 4)
)
Expand Down
Loading