fix(messages): don't send notification to sender of message
Build and Push Docker image / build-and-push (push) Successful in 2m0s Details

This commit is contained in:
Valentin Kolb 2024-06-11 23:30:56 +02:00
parent 94f1d4c586
commit a95ad8a702
1 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,11 @@ import (
// sendEmailNotification sends an email notification to the user
func sendEmailNotification(app *pocketbase.PocketBase, registry *template.Registry, user *models.Record, message *models.Record) {
// check if user and message are set and user is not the sender
if user == nil || message == nil || user.GetId() == message.GetString("sender") {
return
}
userEmail := user.GetString("email")
// check if user has a valid email