mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
clearing channel association when deleting contact
This commit is contained in:
parent
18716162cc
commit
1b5af314a1
@ -42,7 +42,10 @@ func RemoveCard(w http.ResponseWriter, r *http.Request) {
|
||||
// save and update contact revision
|
||||
err = store.DB.Transaction(func(tx *gorm.DB) error {
|
||||
for _, channel := range slot.Card.Channels {
|
||||
if res := tx.Model(&channel).Association("Cards").Delete(&slot.Card); res != nil {
|
||||
if res := tx.Model(&channel).Association("Cards").Delete(slot.Card); res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Model(&channel).Update("detail_revision", account.ChannelRevision+1).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Model(&channel.ChannelSlot).Update("revision", account.ChannelRevision+1).Error; res != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user