From 8d7c7a5a50209d870d703d8c3512317e9430fe64 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Sat, 24 Mar 2018 16:45:13 +0100 Subject: [PATCH] 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. --- database/message.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/message.go b/database/message.go index 1e128ff..a7bbc3f 100644 --- a/database/message.go +++ b/database/message.go @@ -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 }