Skip to content

Commit

Permalink
chore: add stuff for statutory
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxbandit committed Apr 24, 2023
1 parent 9703205 commit c26a688
Show file tree
Hide file tree
Showing 8 changed files with 591 additions and 2 deletions.
42 changes: 40 additions & 2 deletions dispatcher/helpers/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
su_words_list = ['summer', 'awesome', 'your', 'now', 'sustainability', 'culture', 'europe', 'balkan', 'russia', 'adventure', 'ukraine', 'capital', 'montenegro', 'ireland', 'serbia', 'crimea', 'amazing', 'slavaukraini', 'heroiamslava']
def su_sentence():
return faker.sentence(nb_words=5, ext_word_list=su_words_list)
# from constants.js
def agora_sentence():
return f"Agora {faker.sentence(nb_words=1)}"

# from constants.js (at least for core..)
MAIL_SUBJECTS = {
"CORE": {
"MAIL_CONFIRMATION": 'MyAEGEE: Please confirm your account',
Expand All @@ -37,6 +40,15 @@ def su_sentence():
"MAIL_EVENT_STATUS_CHANGED": "Your event's status was changed",
"MAIL_EVENT_SUBMITTED": "An event was submitted",
},
"STATUTORY": {
"MAIL_APPLIED": f"You've successfully applied for {agora_sentence()}",
"MAIL_UPDATED": f"Your application for {agora_sentence()} was updated",
"MAIL_APPLIED_BOARD": f"One of your body members has applied to {agora_sentence()}",
"MAIL_UPDATED_BOARD": f"One of your body members has updated their application to {agora_sentence()}",
"MAIL_CANDIDATE_APPLIED": "A new application was submitted",
"MAIL_MEMBERSLIST_SUBMITTED": "The event was updated",
"MAIL_MEMBERSLIST_EDITED": f"A memberslist has been edited for {agora_sentence()}",
},
"SUMMERUNIVERSITIES": {
"MAIL_APPLIED_MEMBER": f"You've successfully applied for {su_sentence()}",
"MAIL_APPLIED_ORGANISERS": f"Somebody has applied for {su_sentence()}",
Expand Down Expand Up @@ -70,6 +82,15 @@ def su_sentence():
"MAIL_EVENT_STATUS_CHANGED": "events_status_changed",
"MAIL_EVENT_SUBMITTED": "events_submitted",
},
"STATUTORY": {
"MAIL_APPLIED": "statutory_applied",
"MAIL_UPDATED": "statutory_edited",
"MAIL_APPLIED_BOARD": "statutory_board_applied",
"MAIL_UPDATED_BOARD": "statutory_board_edited",
"MAIL_CANDIDATE_APPLIED": "candidate_applied",
"MAIL_MEMBERSLIST_SUBMITTED": "statutory_memberslist_submitted",
"MAIL_MEMBERSLIST_EDITED": "statutory_memberslist_edited",
},
"SUMMERUNIVERSITIES": {
"MAIL_APPLIED_MEMBER": "summeruniversity_applied",
"MAIL_APPLIED_ORGANISERS": "summeruniversity_organizer_applied",
Expand All @@ -85,7 +106,7 @@ def su_sentence():
},
}

RABBIT_HOST='172.18.0.8' #FIXME
RABBIT_HOST='172.18.0.5' #FIXME
connection = pika.BlockingConnection(pika.ConnectionParameters(RABBIT_HOST))
channel = connection.channel()

Expand Down Expand Up @@ -114,6 +135,8 @@ def generate_fake_payload(subj="", template=""):
"place": faker.city(),
"token": faker.md5(),
"old_status": "snafu",
"event_name": agora_sentence(),
"membership_fee": "15⎊",
"event": {
"name": su_sentence(),
"location": faker.city(),
Expand All @@ -135,11 +158,26 @@ def generate_fake_payload(subj="", template=""):
"motivation": "I wanna suck",
"status": "totally snafu",
"email": "[email protected]",
"gender": "Robot",
"date_of_birth": "1985-04-16",
"nationality": "Europe",
"meals": "Steak",
"allergies": "wallopers",
"number_of_events_visited": "over 9000",
"visa_required": "No",
"answers": [
"ho-hoo, ho-hoo",
"42",
],
},
"candidate": {
"first_name": faker.first_name(),
"last_name": faker.last_name(),
},
"position": {
"event_id": "42",
"name": "This gran C commissioner",
},
}
}
return email
Expand Down
82 changes: 82 additions & 0 deletions dispatcher/templates/candidate_applied.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

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

{% import "snippets/macros.jinja2" as macros %}
{{ macros.head("MyAEGEE: New candidature submitted") }}

<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 candidature is submitted</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;">
A new candidature to position
<strong>{{ position["name"] }}</strong>
is submitted by
<strong>{{ candidate["first_name"] }} {{candidate["last_name"] }}</strong>.
</div>
</td>
</tr>
<tr>
<td align="center" style="padding: 0 56px 28px 56px;" valign="top">
<div>
<a href="https://my.aegee.eu/statutory/{{ position["event_id"] }}/positions/all" 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">View candidatures</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>
83 changes: 83 additions & 0 deletions dispatcher/templates/statutory_applied.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

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

{% import "snippets/macros.jinja2" as macros %}
{{ macros.head("MyAEGEE: Your application for VAR"|replace("VAR", event["name"])) }}

<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="AEGEE-Europe"
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>You've successfully applied to {{ event["name"] }}</strong></div>
</td>
</tr>
<tr>
<td 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: 16px; color: #333;">
Here are your application details:
{% include "snippets/statutory_application_info.jinja2" %}
</div>
</td>
</tr>
<tr>
<td 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: 16px; color: #333;">
Have you already subscribed to our internal communication channels? Don’t miss out on any AEGEE news or announcements, subscribe to <a href="https://my.aegee.eu/pages/mailing-lists">our mailing lists</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>
84 changes: 84 additions & 0 deletions dispatcher/templates/statutory_board_applied.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

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

{% import "snippets/macros.jinja2" as macros %}
{{ macros.head("MyAEGEE: A member of your body applied for VAR"|replace("VAR", event["name"])) }}

<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;"
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 member of your body ({{ application["body_name"] }}) applied for {{ event["name"] }}</strong></div>
</td>
</tr>
<tr>
<td 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: 16px; color: #333;">
Here are the application details:
{% include "snippets/statutory_application_info.jinja2" %}
</div>
</td>
</tr>
<tr>
<td align="center" style="padding: 0 56px 28px 56px;" valign="top">
<div>
<a href="https://my.aegee.eu/statutory/{{ event["url"] }}/boardview" 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">Manage boardview</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>
Loading

0 comments on commit c26a688

Please sign in to comment.