Skip to content

Commit

Permalink
add share url to email text
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Richter <[email protected]>
  • Loading branch information
dragonchaser committed Sep 16, 2022
1 parent d568d34 commit 535fa79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{ .ShareSharer }} has shared {{ .ShareFolder }} with you.
{{ .ShareSharer }} has shared {{ .ShareFolder }} with you.

Link: {{ .ShareLink }}
12 changes: 12 additions & 0 deletions services/notifications/pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package service

import (
"context"
"net/url"
"os"
"os/signal"
"syscall"
Expand Down Expand Up @@ -228,10 +229,21 @@ func (s eventsNotifier) handleShareCreated(e events.ShareCreated) {
return
}

shareLink, err := url.JoinPath(e.Executant.Idp, "files/shares/with-me")

if err != nil {
s.logger.Error().
Err(err).
Str("event", "ShareCreated").
Msg("could not create link to the share")
return
}

msg, err := email.RenderEmailTemplate("shareCreated.email.tmpl", map[string]string{
// TODO: add additional fields here (like link etc.)
"ShareSharer": userResponse.User.DisplayName,
"ShareFolder": md.Info.Name,
"ShareLink": shareLink,
}, s.emailTemplatePath)

if err != nil {
Expand Down

0 comments on commit 535fa79

Please sign in to comment.