diff --git a/go.mod b/go.mod index 2f90961b..038fde27 100644 --- a/go.mod +++ b/go.mod @@ -87,4 +87,4 @@ replace ( gopkg.in/fsnotify.v1 => github.com/kolaente/fsnotify v1.4.10-0.20200411160148-1bc3c8ff4048 // See https://github.com/fsnotify/fsnotify/issues/328 and https://github.com/golang/go/issues/26904 ) -go 1.15 +go 1.16 diff --git a/pkg/mail/send_mail.go b/pkg/mail/send_mail.go index 7324110a..a693e798 100644 --- a/pkg/mail/send_mail.go +++ b/pkg/mail/send_mail.go @@ -20,6 +20,7 @@ import ( "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/version" + "io" "github.com/wneessen/go-mail" ) @@ -34,6 +35,7 @@ type Opts struct { ContentType ContentType Boundary string Headers []*header + Embeds map[string]io.Reader } // ContentType represents mail content types @@ -78,10 +80,15 @@ func getMessage(opts *Opts) *mail.Msg { _ = m.From(opts.From) _ = m.To(opts.To) m.Subject(opts.Subject) + for _, h := range opts.Headers { m.SetHeader(h.Field, h.Content) } + for name, content := range opts.Embeds { + m.EmbedReader(name, content) + } + switch opts.ContentType { case ContentTypePlain: m.SetBodyString("text/plain", opts.Message) diff --git a/pkg/modules/migration/trello/trello.go b/pkg/modules/migration/trello/trello.go index c443d3c6..81be1758 100644 --- a/pkg/modules/migration/trello/trello.go +++ b/pkg/modules/migration/trello/trello.go @@ -242,12 +242,12 @@ func convertTrelloDataToVikunja(trelloData []*trello.Board, token string) (fullV log.Debugf("[Trello Migration] Converted label %s from card %s", label.ID, card.ID) } - // Attachments + // Embeds if len(card.Attachments) > 0 { log.Debugf("[Trello Migration] Downloading %d card attachments from card %s", len(card.Attachments), card.ID) } for _, attachment := range card.Attachments { - if attachment.MimeType == "" { // Attachments can also be not downloadable - the mime type is empty in that case. + if attachment.MimeType == "" { // Embeds can also be not downloadable - the mime type is empty in that case. log.Debugf("[Trello Migration] Attachment %s does not have a mime type, not downloading", attachment.ID) continue } diff --git a/pkg/modules/migration/wunderlist/wunderlist.go b/pkg/modules/migration/wunderlist/wunderlist.go index fea6722e..7a1a9d16 100644 --- a/pkg/modules/migration/wunderlist/wunderlist.go +++ b/pkg/modules/migration/wunderlist/wunderlist.go @@ -181,7 +181,7 @@ func convertListForFolder(listID int, list *list, content *wunderlistContents) ( } } - // Attachments + // Embeds for _, f := range content.files { if f.TaskID == t.ID { // Download the attachment and put it in the file diff --git a/pkg/notifications/logo.png b/pkg/notifications/logo.png new file mode 100644 index 00000000..0b62ea0b Binary files /dev/null and b/pkg/notifications/logo.png differ diff --git a/pkg/notifications/mail_render.go b/pkg/notifications/mail_render.go index 0ab72442..997a916a 100644 --- a/pkg/notifications/mail_render.go +++ b/pkg/notifications/mail_render.go @@ -18,7 +18,9 @@ package notifications import ( "bytes" + _ "embed" templatehtml "html/template" + "io" templatetext "text/template" "code.vikunja.io/api/pkg/config" @@ -49,7 +51,7 @@ const mailTemplateHTML = `
@@ -84,6 +86,9 @@ const mailTemplateHTML = `