-
Notifications
You must be signed in to change notification settings - Fork 184
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
The email HTML templates added #6146 #6147
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
@2403905 this needs an update in |
7ceab9b
to
53c2455
Compare
💥 Acceptance test Core-API-Tests-ocis-storage-10 failed. Further test are cancelled... |
e6bf6aa
to
8f94a45
Compare
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.
Some suggestions
var data map[string][]byte | ||
data, err = readImages(emailTemplatePath) | ||
if err != nil { | ||
return "", "", err | ||
data, err = readFs() | ||
if err != nil { | ||
return nil, err | ||
} |
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.
I don't like the try/catch logic. Two possible alternatives:
(1) Simple Solution: check emailTemplatePath == ""
and use readFS
if true, otherwise readImages
(2) Master Solution: Make RenderEmailTemplate
use an fs.FS
instead the emailTemplatePath
. On service start create a fs.FS
either using templatesFS
or os.DirFS(emailTemplatePath)
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.
Sure, I'll change it. I just followed the current approach https://github.com/owncloud/ocis/blob/master/services/notifications/pkg/email/email.go#L49
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.
That's not nice either 😄 Let's do it correctly here.
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.
@kobergj done. These changes impacted the email Template Path
and now it shouldn't contain the templates
subdirectory. The reason why it happened was the templatesFS
contains templates
and no way to get the subdirectory for the embed FS. Is it ok?
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.
The NOTIFICATIONS_EMAIL_TEMPLATE_PATH will be like this
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/text/email.text.tmpl
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/html/email.html.tmpl
@micbar @kobergj @dragonchaser are you ok with it?
I updated the readme
services/notifications/README.md
Outdated
@@ -35,6 +43,7 @@ templates | |||
``` | |||
|
|||
Custom email templates referenced via `NOTIFICATIONS_EMAIL_TEMPLATE_PATH` must also be located in subfolders `shares` and `spaces` and must have the same names as the embedded templates. It is important that the names of these files and folders match the embedded ones. | |||
In the subfolder `html` contains a default HTML template provided by ocis. The images can be embedded in a custom HTML template as a CID source ```<img src="cid:logo-mail.gif" alt="logo-mail"/>``` The image files should be located in `html/img` subfolder. Supported image types are png, jpeg, and gif. |
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.
In the subfolder `html` contains a default HTML template provided by ocis. The images can be embedded in a custom HTML template as a CID source ```<img src="cid:logo-mail.gif" alt="logo-mail"/>``` The image files should be located in `html/img` subfolder. Supported image types are png, jpeg, and gif. | |
The `html` subfolder contains a default HTML template provided by ocis. When using a custom HTML template, images can either be linked with standard HTML code or embedded as a CID source ```<img src="cid:logo-mail.gif" alt="logo-mail"/>``` In the latter case, image files must be located in the `html/img` subfolder. Supported image types are png, jpeg, and gif. |
What about svg images, are we open for this when embedding?
Note that I have read (and I may be wrong) that embedding images via CID can cause issues_1 or issues_2 in web clients. Should we drop a note here? like:
Consider that embedding images via a CID resource may not be fully supported in all email web clients.
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.
@mmattel Good points
- We do not support svg when embedding.
- Let's make a notice about embedding and add that hosted images source are also available like
<img src="https://raw.githubusercontent.com/owncloud/core/master/core/img/logo-mail.gif" alt="logo-mail"/>
Or better make the hosted images as a default way?
BTW How it works in ownCloud 10?
FYI @kobergj @micbar
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.
Or better make the hosted images as a default way?
CID linking is ok then admins can see how that has to look like.
Embedding via standard html is imho commonly known.
Note that the blank line 23 in readme.md (between the list items) could be removed. I cant make a suggestable commit... |
b82cf3d
to
7724950
Compare
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.
I agree with the suggestions.
All in all it looks really awesome to me. Thank you @2403905
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.
OK from the docs pov
Co-authored-by: Martin <github@diemattels.at>
Co-authored-by: Martin <github@diemattels.at>
Kudos, SonarCloud Quality Gate passed! |
* The email HTML templates added #6146 * use a single palne text email template. use fs.FS * Update services/notifications/README.md Co-authored-by: Martin <github@diemattels.at> * Update services/notifications/README.md Co-authored-by: Martin <github@diemattels.at> * fix md --------- Co-authored-by: Roman Perekhod <rperekhod@owncloud.com> Co-authored-by: Martin <github@diemattels.at>
* The email HTML templates added #6146 * use a single palne text email template. use fs.FS * Update services/notifications/README.md Co-authored-by: Martin <github@diemattels.at> * Update services/notifications/README.md Co-authored-by: Martin <github@diemattels.at> * fix md --------- Co-authored-by: Roman Perekhod <rperekhod@owncloud.com> Co-authored-by: Martin <github@diemattels.at>
Description
The email HTML templates has been added to the notifications service.
The built-in templates can be replaced with custom.
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: