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:
parent
317bb1cb3e
commit
8d7c7a5a50
|
|
@ -47,7 +47,7 @@ func (d *GormDatabase) DeleteMessagesByApplication(applicationID uint) error {
|
||||||
// DeleteMessagesByUser deletes all messages from a user.
|
// DeleteMessagesByUser deletes all messages from a user.
|
||||||
func (d *GormDatabase) DeleteMessagesByUser(userID uint) error {
|
func (d *GormDatabase) DeleteMessagesByUser(userID uint) error {
|
||||||
for _, app := range d.GetApplicationsByUser(userID) {
|
for _, app := range d.GetApplicationsByUser(userID) {
|
||||||
d.DB.Model(app).Association("Messages").Clear()
|
d.DeleteMessagesByApplication(app.ID)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue