From 1b5af314a1d5158e2bdc2e42979c92633d518b6a Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Tue, 11 Oct 2022 13:56:27 -0700 Subject: [PATCH] clearing channel association when deleting contact --- net/server/internal/api_removeCard.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/server/internal/api_removeCard.go b/net/server/internal/api_removeCard.go index d4a3cb79..fc7ba44e 100644 --- a/net/server/internal/api_removeCard.go +++ b/net/server/internal/api_removeCard.go @@ -42,9 +42,12 @@ 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 { return res }