-
Notifications
You must be signed in to change notification settings - Fork 85
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
Explore using Jinja for templating #376
Merged
Merged
Changes from 7 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
ed107ee
add jinja to setup
H-Shay 338bd5d
update send_email function to render templates with jinja
H-Shay 589c396
change templates to use jinja
H-Shay 8e40335
lints
H-Shay 7c81e22
Add changelog
H-Shay c34bd99
merge with main to update branch
H-Shay a2106c1
add .j2 templates
H-Shay 35eea47
check if jinja templates available and if so use them
H-Shay 3f22e70
rename changelog file, version jinja in setup.py
H-Shay a97b0ae
lints
H-Shay 525be72
requested changes
H-Shay 308f9dc
revoke change to terms.py
H-Shay a721485
add some tests
H-Shay a542201
use jinja environment and autoescape
H-Shay fb7db3c
format jinja templates for autoescape and test
H-Shay 35c2640
fix tests, fix jinja templates
H-Shay a3adf42
lints + update tests
H-Shay dd46fae
reset terms
H-Shay 96580b9
update templates with safe filter
H-Shay c35fd94
move jinja environment creation to startup, add env to sydent
H-Shay 56e0750
update tests
H-Shay 4606fde
lints
H-Shay a5f1416
update template files
H-Shay 808b539
update tests and send_email function
H-Shay f0f25cd
reset terms
H-Shay e75c4d7
update templates
H-Shay ab9ccec
only manually escape old templates
H-Shay 5c8dc2e
update tests
H-Shay e43f0f9
add smaple text for testing
H-Shay 3e3b116
update tests name
H-Shay 6c60693
lints + rename jinja tests
H-Shay 9880e0c
update sydent.py
H-Shay 5379f85
requested changes + lints
H-Shay 611ee4a
update templates
H-Shay 0baa33c
requested changes + add licence
H-Shay 4010fd5
lints
H-Shay a9dcbcf
slight refactor
H-Shay d4d0486
requested change + lints
H-Shay 2da3529
Merge branch 'main' into jinja
H-Shay b0599a7
fix error in redering emails
H-Shay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ Hi, | |
{{ bracketed_room_name|safe }}on Element. To join the conversation please follow the | ||
link below. | ||
|
||
{{ web_client_location }}/#/room/{{ room_id_forurl }}?email={{ to_forurl }}&signurl=https%%3A%%2F%%2Fvector.im%%2F_matrix%%2Fidentity%%2Fapi%%2Fv1%%2Fsign-ed25519%%3Ftoken%%3D{{ token }}%%26private_key%%3D{{ ephemeral_private_key }}&room_name={{ room_name_forurl }}&room_avatar_url={{ room_avatar_url_forurl }}&inviter_name={{ sender_display_name_forurl }}&guest_access_token={{ guest_access_token_forurl }}&guest_user_id={{ guest_user_id_forurl }} | ||
{{ web_client_location }}/#/room/{{ room_id|urlencode }}?email={{ to|urlencode }}&signurl=https%3A%2F%2Fvector.im%2F_matrix%2Fidentity%2Fapi%2Fv1%2Fsign-ed25519%3Ftoken%3D{{ token|urlencode }}%26private_key%3D{{ ephemeral_private_key|urlencode }}&room_name={{ room_name|urlencode }}&room_avatar_url={{ room_avatar_url|urlencode }}&inviter_name={{ sender_display_name|urlencode }}&guest_access_token={{ guest_access_token|urlencode }}&guest_user_id={{ guest_user_id|urlencode }} | ||
|
||
Element is an open source collaboration app built on the Matrix.org | ||
open standard for interoperable communication: supporting group chat, | ||
|
@@ -123,12 +123,12 @@ pre, code { | |
|
||
<p>Hi,</p> | ||
|
||
<p>{{ sender_display_name_forhtml }} <span class="low-contrast">{{ bracketed_verified_sender_forhtml }}</span> has invited you into a | ||
room {{ bracketed_room_name_forhtml }} on Element.</p> | ||
<p>{{ sender_display_name }} <span class="low-contrast">{{ bracketed_verified_sender }}</span> has invited you into a | ||
room {{ bracketed_room_name }} on Element.</p> | ||
|
||
<p> | ||
<a | ||
href="https://app.element.io/#/room/{{ room_id_forurl }}?email={{ to_forurl }}&signurl=https%%3A%%2F%%2Fvector.im%%2F_matrix%%2Fidentity%%2Fapi%%2Fv1%%2Fsign-ed25519%%3Ftoken%%3D{{ token }}%%26private_key%%3D{{ ephemeral_private_key }}&room_name={{ room_name_forurl }}&room_avatar_url={{ room_avatar_url_forurl }}&inviter_name={{ sender_display_name_forurl }}&guest_access_token={{ guest_access_token_forurl }}&guest_user_id={{ guest_user_id_forurl }}">Join the conversation.</a> | ||
href="https://app.element.io/#/room/{{ room_id|urlencode }}?email={{ to|urlencode }}&signurl=https%3A%2F%2Fvector.im%2F_matrix%2Fidentity%2Fapi%2Fv1%2Fsign-ed25519%3Ftoken%3D{{ token|urlencode }}%26private_key%3D{{ ephemeral_private_key|urlencode }}&room_name={{ room_name|urlencode }}&room_avatar_url={{ room_avatar_url|urlencode }}&inviter_name={{ sender_display_name|urlencode }}&guest_access_token={{ guest_access_token|urlencode }}&guest_user_id={{ guest_user_id|urlencode }}">Join the conversation.</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing about |
||
</p> | ||
|
||
<p>Element is an open source collaboration app built on the Matrix.org | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
Hello there! | ||
|
||
You have asked us to register this email address with element.io - the open source, | ||
distributed and secure shared workspace for the web that's built on Matrix. | ||
|
||
If it was really you who made this request, you can click on the following link to | ||
complete the verification of your email address: | ||
|
||
https%3A//link_test.com | ||
reivilibre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Please note that you will need to use Chrome, Firefox or Safari on the web, or | ||
iOS or Android on mobile. | ||
|
||
If you didn't make this request, you can safely disregard this email. | ||
|
||
Thanks! | ||
|
||
Element | ||
|
||
|
||
About Element: | ||
|
||
Break through - Element allows teams to communicate across a wide range of collaboration | ||
apps. If some team members use Element while others use IRC, Slack or Gitter, Element will | ||
allow these team members to seamlessly work together. Element offers the richest | ||
network of communication bridges. | ||
|
||
Own Your Own Data - No one should control your communication and data but you. Element | ||
lets you run your own server, and provides users and teams with the most advanced | ||
crypto ratchet technology available today for a decentralized secure Internet. | ||
|
||
Open Source - Element is entirely open source: all the code is published on GitHub | ||
(Apache License) for anyone to see and extend. This means teams can customize or | ||
contribute to the code and everyone can benefit from the speed of community innovation. | ||
|
||
Made on Matrix - Element is built on top of Matrix. Matrix is an open network for secure, | ||
decentralized communication delivering a community of users, bridged networks, | ||
integrated bots and applications plus full end-to-end encryption. To learn more about | ||
Matrix visit https://matrix.org. | ||
|
||
Content-Type: text/html; charset=UTF-8 | ||
Content-Disposition: inline | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<style type="text/css"> | ||
body { | ||
margin: 0px; | ||
} | ||
|
||
pre, code { | ||
word-break: break-word; | ||
white-space: pre-wrap; | ||
} | ||
|
||
#page { | ||
font-family: 'Open Sans', Helvetica, Arial, Sans-Serif; | ||
font-color: #454545; | ||
font-size: 12pt; | ||
width: 100%%; | ||
padding: 20px; | ||
} | ||
|
||
#inner { | ||
width: 640px; | ||
} | ||
|
||
.header { | ||
width: 100%%; | ||
height: 87px; | ||
color: #454545; | ||
border-bottom: 4px solid #e5e5e5; | ||
} | ||
|
||
.logo { | ||
text-align: right; | ||
margin-left: 20px; | ||
} | ||
|
||
.header { | ||
border-bottom: 4px solid #e4f7ed ! important; | ||
} | ||
|
||
|
||
.notif_link a, .footer a { | ||
color: #76CFA6 ! important; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<table id="page"> | ||
<tr> | ||
<td> </td> | ||
<td id="inner"> | ||
<table class="header"> | ||
<tr> | ||
<td> | ||
</td> | ||
<td class="logo"> | ||
<img src="https://static.element.io/images/email-logo.png" width="64" height="64" alt="Element"/> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<p>Hello there!</p> | ||
|
||
<p>You have asked us to register this email address with element.io - the open source, | ||
distributed and secure shared workspace for the web that's built on Matrix.</p> | ||
|
||
<p>If it was really you who made this request, you can click on the following link to | ||
complete the verification of your email address:</p> | ||
|
||
<p><a href="https%3A//link_test.com">Complete email verification</a></p> | ||
|
||
|
||
<p>Please note that Element requires | ||
<a href="https://www.google.com/chrome">Chrome</a>, | ||
<a href="https://www.getfirefox.com">Firefox</a> or | ||
<a href="https://www.apple.com/safari">Safari</a> on the web, | ||
or iOS or Android on mobile.</p> | ||
|
||
<p>If you didn't make this request, you can safely disregard this email.</p> | ||
|
||
<p>Thanks!</p> | ||
|
||
<p>Element</p> | ||
|
||
<br> | ||
<p>About Element:</p> | ||
|
||
<p><em>Break through</em> - Element allows teams to communicate across a wide range of collaboration | ||
apps. If some team members use Element while others use IRC, Slack or Gitter, Element will | ||
allow these team members to seamlessly work together. Element offers the richest | ||
network of communication bridges.</p> | ||
|
||
<p><em>Own Your Own Data</em> - No one should control your communication and data but you. Element | ||
lets you run your own server, and provides users and teams with the most advanced | ||
crypto ratchet technology available today for a decentralized secure Internet.</p> | ||
|
||
<p><em>Open Source</em> - Element is entirely open source: all the code is published on GitHub | ||
(Apache License) for anyone to see and extend. This means teams can customize or | ||
contribute to the code and everyone can benefit from the speed of community innovation.</p> | ||
|
||
<p><em>Made on Matrix</em> - Element is built on top of Matrix. Matrix is an open network for secure, | ||
decentralized communication delivering a community of users, bridged networks, | ||
integrated bots and applications plus full end-to-end encryption. To learn more about | ||
Matrix visit https://matrix.org.</p> | ||
|
||
</td> | ||
<td> </td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, should this be using
{{ web_client_location }}
here too? (Probably copied from the non-Jinja version though.) We might want to fix that separately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed from the older version, I will fix in separate PR.