1
0

Send a notification to the user when they are added to the list

This commit is contained in:
kolaente
2021-02-17 20:48:06 +01:00
parent 0bd27ddeb7
commit c873c1ec32
5 changed files with 61 additions and 6 deletions

View File

@ -22,6 +22,8 @@ import (
"reflect"
"time"
"code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/db"
"xorm.io/xorm"
@ -116,6 +118,11 @@ func (u *User) GetName() string {
return u.Username
}
// GetNameAndFromEmail returns the name and email address for a user. Useful to use in notifications.
func (u *User) GetNameAndFromEmail() string {
return u.GetName() + " via Vikunja <" + config.MailerFromEmail.GetString() + ">"
}
// GetFromAuth returns a user object from a web.Auth object and returns an error if the underlying type
// is not a user object
func GetFromAuth(a web.Auth) (*User, error) {