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

fix(core): add mail for new members to workspace admins #107

Merged
merged 2 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
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
73 changes: 73 additions & 0 deletions lib/omsmailer_web/templates/page/workspace_new_member.html.eex
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

<!DOCTYPE html>
<html lang="en">

<%= render(OmsmailerWeb.SnippetsView, "head.html", title: "MyAEGEE: A new member has joined their first local") %>


<body style="width:100% !important;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;">
<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" style="margin:0; padding:0; width:100% !important; line-height: 100% !important; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;background-color: #F9FAFB;"
width="100%">
<tbody>
<tr>
<td width="10" valign="top">&nbsp;</td>
<td valign="top" align="center">
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width: 100%; max-width: 600px; background-color: #FFF; border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;"
id="contentTable">
<tbody>
<tr>
<td width="600" valign="top" align="center" style="border-collapse:collapse;">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background: #F9FAFB;" width="100%">
<tbody>
<tr>
<td align="center" valign="top">
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;">&nbsp;</div>
</td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #E0E4E8;"
width="100%">
<tbody>
<tr>
<td align="center" style="padding: 56px 56px 28px 56px;" valign="top">
<a style="color: #3498DB; text-decoration: none;" href="my.aegee.eu"
target="_blank"><img style="width: 56px; height: 56px; border: 0;" alt="Logo"
src="https://my.aegee.eu/images/logo.png">
</a></td>
</tr>
<tr>
<td align="center" style="padding: 0 56px 28px 56px;" valign="top">
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 20px; color: #333;"><strong>A new member has joined their first local!</strong></div>
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 16px; color: #333;">First name: <%= @parameters["member_firstname"] %></div>
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 16px; color: #333;">Last name: <%= @parameters["member_lastname"] %></div>
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 16px; color: #333;">Email: <%= @parameters["member_email"] %></div>
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 16px; color: #333;">Profile: <a href="https://my.aegee.eu/members/<%= Map.fetch!(@parameters, "user_id") %>" style="background-color:#1468C5;border-radius:50px;color:#ffffff;display:inline-block;font-family: 'lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:18px;font-weight: bold;line-height:40px;text-align:center;text-decoration:none;width:270px;-webkit-text-size-adjust:none;"
target="_blank">https://my.aegee.eu/members/<%= Map.fetch!(@parameters, "user_id") %></a></div>
</td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background: #F9FAFB;" width="100%">
<tbody>
<tr>
<td align="center" style="padding: 28px 56px;" valign="top">
<div style="font-family: &quot;lato&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; line-height: 28px;font-size: 16px; line-height: 24px; color: #A7ADB5;">This email was autogenerated by MyAEGEE mailer.</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>



</body>

</html>
7 changes: 7 additions & 0 deletions test/omsmailer_web/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ defmodule OmsmailerWeb.PageControllerTest do
assert_email_delivered_with(subject: "pirates")
end

# Workspace new member works
test "POST / workspace_new_member", %{conn: conn} do
conn = post conn, "/", %{template: "workspace_new_member.html", parameters: %{member_firstname: "Franz", member_lastname: "Ferdinant", user_id: 1, email: "f.ferdinant@aegee.test"}, from: "mailer@aegee.org", to: "test@aegee.org", subject: "pirates"}
assert json_response(conn, 200)
assert_email_delivered_with(subject: "pirates")
end

# Membership expired
test "POST / membership expired", %{conn: conn} do
conn = post conn, "/", %{template: "membership_expired.html", parameters: %{body: "AEGEE-Dresden", last_payment: "2018-11-23T08:51:04.038159"}, from: "mailer@aegee.org", to: "test@aegee.org", subject: "pirates"}
Expand Down