Correctly delete all messages from a user

Till now only the ApplicationID got remove from the message, therefore
the message was still in the database but not visible for the user.
This commit is contained in:
Jannis Mattheis
2018-03-24 16:45:13 +01:00
committed by Jannis Mattheis
parent 317bb1cb3e
commit 8d7c7a5a50

View File

@@ -47,7 +47,7 @@ func (d *GormDatabase) DeleteMessagesByApplication(applicationID uint) error {
// DeleteMessagesByUser deletes all messages from a user.
func (d *GormDatabase) DeleteMessagesByUser(userID uint) error {
for _, app := range d.GetApplicationsByUser(userID) {
d.DB.Model(app).Association("Messages").Clear()
d.DeleteMessagesByApplication(app.ID)
}
return nil
}