Friend request notify

This commit is contained in:
LittleSheep 2024-04-06 01:26:38 +08:00
parent af615cebd7
commit 8dbb8c522a

View File

@ -69,6 +69,12 @@ func NewFriend(user models.Account, related models.Account, status models.Friend
if err := database.C.Save(&relationship).Error; err != nil { if err := database.C.Save(&relationship).Error; err != nil {
return relationship, err return relationship, err
} else {
_ = NewNotification(models.Notification{
Subject: fmt.Sprintf("New friend request from %s", user.Name),
Content: fmt.Sprintf("You got a new friend request from %s. Go to your settings and decide how to deal it.", user.Nick),
RecipientID: related.ID,
})
} }
return relationship, nil return relationship, nil