using member table channel membership

This commit is contained in:
Roland Osborne 2022-11-11 15:26:43 -08:00
parent ff564c24d6
commit 7fde0558bb
22 changed files with 79 additions and 66 deletions

View File

@ -49,7 +49,13 @@ func AddChannel(w http.ResponseWriter, r *http.Request) {
if res := tx.Preload("Card").Where("account_id = ? AND card_slot_id = ?", account.ID, cardID).First(&cardSlot).Error; res != nil { if res := tx.Preload("Card").Where("account_id = ? AND card_slot_id = ?", account.ID, cardID).First(&cardSlot).Error; res != nil {
return res return res
} }
if res := tx.Model(&slot.Channel).Association("Cards").Append(cardSlot.Card); res != nil { member := &store.Member{}
member.ChannelID = channel.ID
member.CardID = cardSlot.Card.ID
member.Card = *cardSlot.Card
member.Channel = channel
member.PushEnabled = true
if res := tx.Save(member).Error; res != nil {
return res return res
} }
cards = append(cards, cardSlot.Card) cards = append(cards, cardSlot.Card)

View File

@ -75,8 +75,8 @@ func AddChannelTopic(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -153,8 +153,8 @@ func AddChannelTopicAsset(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -94,8 +94,8 @@ func AddChannelTopicTag(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -24,7 +24,7 @@ func ClearChannelCard(w http.ResponseWriter, r *http.Request) {
// load referenced channel // load referenced channel
var channelSlot store.ChannelSlot var channelSlot store.ChannelSlot
if err := store.DB.Preload("Channel.Cards.CardSlot").Preload("Channel.Groups.GroupSlot").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&channelSlot).Error; err != nil { if err := store.DB.Preload("Channel.Members.Card.CardSlot").Preload("Channel.Groups.GroupSlot").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&channelSlot).Error; err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) { if !errors.Is(err, gorm.ErrRecordNotFound) {
ErrResponse(w, http.StatusInternalServerError, err) ErrResponse(w, http.StatusInternalServerError, err)
} else { } else {
@ -54,8 +54,8 @@ func ClearChannelCard(w http.ResponseWriter, r *http.Request) {
// determine contact list // determine contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {
@ -65,13 +65,13 @@ func ClearChannelCard(w http.ResponseWriter, r *http.Request) {
// save and update contact revision // save and update contact revision
err = store.DB.Transaction(func(tx *gorm.DB) error { err = store.DB.Transaction(func(tx *gorm.DB) error {
if res := tx.Model(&channelSlot.Channel).Association("Cards").Delete(cardSlot.Card); res != nil { if res := tx.Where("channel_id = ? AND card_id = ?", channelSlot.Channel.ID, cardSlot.Card.ID).Delete(&store.Member{}).Error; res != nil {
return res return res
} }
if res := tx.Model(&channelSlot.Channel).Update("detail_revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&store.Channel{}).Where("id = ?", channelSlot.Channel.ID).Update("detail_revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
if res := tx.Model(&channelSlot).Update("revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&store.ChannelSlot{}).Where("id = ?", channelSlot.ID).Update("revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil {

View File

@ -40,7 +40,7 @@ func GetChannelDetail(w http.ResponseWriter, r *http.Request) {
// load channel // load channel
var slot store.ChannelSlot var slot store.ChannelSlot
if err := store.DB.Preload("Channel.Cards.CardSlot").Preload("Channel.Groups.Cards").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_slot_id = ?", act.ID, channelID).First(&slot).Error; err != nil { if err := store.DB.Preload("Channel.Members.Card.CardSlot").Preload("Channel.Groups.Cards").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_slot_id = ?", act.ID, channelID).First(&slot).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
ErrResponse(w, http.StatusNotFound, err) ErrResponse(w, http.StatusNotFound, err)
} else { } else {

View File

@ -42,7 +42,7 @@ func GetChannelSummary(w http.ResponseWriter, r *http.Request) {
var slot store.ChannelSlot var slot store.ChannelSlot
if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB { if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB {
return store.DB.Order("topics.id DESC").Limit(1) return store.DB.Order("topics.id DESC").Limit(1)
}).Preload("Channel.Cards.CardSlot").Preload("Channel.Groups.Cards").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_slot_id = ?", act.ID, channelID).First(&slot).Error; err != nil { }).Preload("Channel.Members.Card").Preload("Channel.Groups.Cards").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_slot_id = ?", act.ID, channelID).First(&slot).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
ErrResponse(w, http.StatusNotFound, err) ErrResponse(w, http.StatusNotFound, err)
} else { } else {

View File

@ -36,9 +36,9 @@ func GetChannelTopic(w http.ResponseWriter, r *http.Request) {
WriteResponse(w, getTopicModel(&topicSlot)) WriteResponse(w, getTopicModel(&topicSlot))
} }
func isMember(guid string, cards []store.Card) bool { func isMember(guid string, members []store.Member) bool {
for _, card := range cards { for _, member := range members {
if guid == card.GUID { if guid == member.Card.GUID {
return true return true
} }
} }
@ -86,7 +86,7 @@ func getChannelSlot(r *http.Request, member bool) (slot store.ChannelSlot, guid
} }
// load channel // load channel
if err = store.DB.Preload("Account").Preload("Channel.Cards").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&slot).Error; err != nil { if err = store.DB.Preload("Account").Preload("Channel.Members.Card").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&slot).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
code = http.StatusNotFound code = http.StatusNotFound
} else { } else {
@ -102,11 +102,11 @@ func getChannelSlot(r *http.Request, member bool) (slot store.ChannelSlot, guid
// validate access to channel // validate access to channel
if tokenType == APPTokenContact { if tokenType == APPTokenContact {
if member && !isMember(guid, slot.Channel.Cards) { if member && !isMember(guid, slot.Channel.Members) {
err = errors.New("contact is not a channel member") err = errors.New("contact is not a channel member")
code = http.StatusUnauthorized code = http.StatusUnauthorized
return return
} else if !isViewer(guid, slot.Channel.Groups) && !isMember(guid, slot.Channel.Cards) { } else if !isViewer(guid, slot.Channel.Groups) && !isMember(guid, slot.Channel.Members) {
err = errors.New("contact is not a channel viewer") err = errors.New("contact is not a channel viewer")
code = http.StatusUnauthorized code = http.StatusUnauthorized
return return

View File

@ -69,7 +69,7 @@ func GetChannels(w http.ResponseWriter, r *http.Request) {
} else { } else {
if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB { if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB {
return store.DB.Order("topics.id DESC") return store.DB.Order("topics.id DESC")
}).Preload("Channel.Cards.CardSlot").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_id != 0", account.ID).Find(&slots).Error; err != nil { }).Preload("Channel.Members.Card.CardSlot").Preload("Channel.Groups.GroupSlot").Where("account_id = ? AND channel_id != 0", account.ID).Find(&slots).Error; err != nil {
ErrResponse(w, http.StatusInternalServerError, err) ErrResponse(w, http.StatusInternalServerError, err)
return return
} }
@ -108,14 +108,14 @@ func GetChannels(w http.ResponseWriter, r *http.Request) {
account := &card.Account account := &card.Account
var slots []store.ChannelSlot var slots []store.ChannelSlot
if channelRevisionSet { if channelRevisionSet {
if err := store.DB.Preload("Channel.Cards").Preload("Channel.Groups.Cards").Where("account_id = ? AND revision > ?", account.ID, channelRevision).Find(&slots).Error; err != nil { if err := store.DB.Preload("Channel.Members.Card").Preload("Channel.Groups.Cards").Where("account_id = ? AND revision > ?", account.ID, channelRevision).Find(&slots).Error; err != nil {
ErrResponse(w, http.StatusInternalServerError, err) ErrResponse(w, http.StatusInternalServerError, err)
return return
} }
} else { } else {
if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB { if err := store.DB.Preload("Channel.Topics", func(db *gorm.DB) *gorm.DB {
return store.DB.Order("topics.id DESC") return store.DB.Order("topics.id DESC")
}).Preload("Channel.Cards").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_id != 0", account.ID).Find(&slots).Error; err != nil { }).Preload("Channel.Members.Card").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_id != 0", account.ID).Find(&slots).Error; err != nil {
ErrResponse(w, http.StatusInternalServerError, err) ErrResponse(w, http.StatusInternalServerError, err)
return return
} }
@ -150,8 +150,8 @@ func isChannelShared(guid string, channel *store.Channel) bool {
if channel == nil { if channel == nil {
return false return false
} }
for _, card := range channel.Cards { for _, member := range channel.Members {
if guid == card.GUID { if guid == member.Card.GUID {
return true return true
} }
} }

View File

@ -51,8 +51,8 @@ func RemoveCard(w http.ResponseWriter, r *http.Request) {
if res := tx.Model(&channel.ChannelSlot).Update("revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&channel.ChannelSlot).Update("revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
for _, card := range channel.Cards { for _, member := range channel.Members {
cards[card.GUID] = &card cards[member.Card.GUID] = &member.Card
} }
} }
if res := tx.Model(&slot.Card).Association("Groups").Clear(); res != nil { if res := tx.Model(&slot.Card).Association("Groups").Clear(); res != nil {

View File

@ -43,7 +43,7 @@ func RemoveChannel(w http.ResponseWriter, r *http.Request) {
// load channel // load channel
var slot store.ChannelSlot var slot store.ChannelSlot
if err = store.DB.Preload("Channel.Cards").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&slot).Error; err != nil { if err = store.DB.Preload("Channel.Members.Card").Preload("Channel.Groups.Cards").Where("account_id = ? AND channel_slot_id = ?", account.ID, channelID).First(&slot).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
ErrResponse(w, http.StatusNotFound, err) ErrResponse(w, http.StatusNotFound, err)
} else { } else {
@ -58,8 +58,8 @@ func RemoveChannel(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range slot.Channel.Cards { for _, member := range slot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range slot.Channel.Groups { for _, group := range slot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {
@ -76,7 +76,7 @@ func RemoveChannel(w http.ResponseWriter, r *http.Request) {
if res := tx.Model(&slot.Channel).Association("Cards").Clear(); res != nil { if res := tx.Model(&slot.Channel).Association("Cards").Clear(); res != nil {
return res return res
} }
slot.Channel.Cards = []store.Card{} slot.Channel.Members = []store.Member{}
if res := tx.Where("channel_id = ?", slot.Channel.ID).Delete(&store.Tag{}).Error; res != nil { if res := tx.Where("channel_id = ?", slot.Channel.ID).Delete(&store.Tag{}).Error; res != nil {
return res return res
} }
@ -121,15 +121,15 @@ func RemoveChannel(w http.ResponseWriter, r *http.Request) {
return return
} }
err = store.DB.Transaction(func(tx *gorm.DB) error { err = store.DB.Transaction(func(tx *gorm.DB) error {
if res := tx.Model(&slot.Channel).Association("Cards").Delete(contact); res != nil { if res := tx.Where("channel_id = ? AND card_id = ?", slot.Channel.ID, contact.ID).Delete(&store.Member{}).Error; res != nil {
return res
}
if res := tx.Model(&slot.Channel).Update("detail_revision", account.ChannelRevision+1).Error; res != nil {
return res
}
if res := tx.Model(&slot).Update("revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
if res := tx.Model(&store.Channel{}).Where("id = ?", slot.Channel.ID).Update("detail_revision", account.ChannelRevision+1).Error; res != nil {
return res
}
if res := tx.Model(&store.ChannelSlot{}).Where("id = ?", slot.ID).Update("revision", account.ChannelRevision+1).Error; res != nil {
return res
}
if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }

View File

@ -86,8 +86,8 @@ func RemoveChannelTopic(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -76,8 +76,8 @@ func RemoveChannelTopicAsset(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -98,8 +98,8 @@ func RemoveChannelTopicTag(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -54,8 +54,8 @@ func SetChannelCard(w http.ResponseWriter, r *http.Request) {
// determine contact list // determine contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {
@ -66,13 +66,19 @@ func SetChannelCard(w http.ResponseWriter, r *http.Request) {
// save and update contact revision // save and update contact revision
err = store.DB.Transaction(func(tx *gorm.DB) error { err = store.DB.Transaction(func(tx *gorm.DB) error {
if res := tx.Model(&channelSlot.Channel).Association("Cards").Append(cardSlot.Card); res != nil { member := &store.Member{}
member.ChannelID = channelSlot.Channel.ID
member.CardID = cardSlot.Card.ID
member.Channel = channelSlot.Channel
member.Card = *cardSlot.Card
member.PushEnabled = true
if res := tx.Save(member).Error; res != nil {
return res return res
} }
if res := tx.Model(&channelSlot.Channel).Update("detail_revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&store.Channel{}).Where("id = ?", channelSlot.Channel.ID).Update("detail_revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
if res := tx.Model(&channelSlot).Update("revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&store.ChannelSlot{}).Where("id = ?", channelSlot.ID).Update("revision", account.ChannelRevision+1).Error; res != nil {
return res return res
} }
if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil { if res := tx.Model(&account).Update("channel_revision", account.ChannelRevision+1).Error; res != nil {

View File

@ -44,8 +44,8 @@ func SetChannelSubject(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range slot.Channel.Cards { for _, member := range slot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range slot.Channel.Groups { for _, group := range slot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -75,8 +75,8 @@ func SetChannelTopicConfirmed(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -88,8 +88,8 @@ func SetChannelTopicSubject(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -92,8 +92,8 @@ func SetChannelTopicTagSubject(w http.ResponseWriter, r *http.Request) {
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range channelSlot.Channel.Cards { for _, member := range channelSlot.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range channelSlot.Channel.Groups { for _, group := range channelSlot.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {

View File

@ -179,15 +179,15 @@ func getChannelDetailModel(slot *store.ChannelSlot, showList bool, image bool, a
groups = append(groups, group.GroupSlot.GroupSlotID) groups = append(groups, group.GroupSlot.GroupSlotID)
} }
var cards []string var cards []string
for _, card := range slot.Channel.Cards { for _, member := range slot.Channel.Members {
cards = append(cards, card.CardSlot.CardSlotID) cards = append(cards, member.Card.CardSlot.CardSlotID)
} }
contacts = &ChannelContacts{Groups: groups, Cards: cards} contacts = &ChannelContacts{Groups: groups, Cards: cards}
} }
members := []string{} members := []string{}
for _, card := range slot.Channel.Cards { for _, member := range slot.Channel.Members {
members = append(members, card.GUID) members = append(members, member.Card.GUID)
} }
return &ChannelDetail{ return &ChannelDetail{

View File

@ -103,7 +103,7 @@ type Session struct {
AppVersion string AppVersion string
Platform string Platform string
PushEnabled bool PushEnabled bool
PushToken string PushToken string
Created int64 `gorm:"autoCreateTime"` Created int64 `gorm:"autoCreateTime"`
Account Account `gorm:"references:GUID"` Account Account `gorm:"references:GUID"`
Token string `gorm:"not null;index:sessguid,unique"` Token string `gorm:"not null;index:sessguid,unique"`
@ -243,7 +243,6 @@ type Channel struct {
Created int64 `gorm:"autoCreateTime"` Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"` Updated int64 `gorm:"autoUpdateTime"`
Groups []Group `gorm:"many2many:channel_groups;"` Groups []Group `gorm:"many2many:channel_groups;"`
Cards []Card `gorm:"many2many:channel_cards;"`
Members []Member Members []Member
Topics []Topic Topics []Topic
ChannelSlot ChannelSlot ChannelSlot ChannelSlot
@ -254,6 +253,8 @@ type Member struct {
ChannelID uint ChannelID uint
CardID uint CardID uint
PushEnabled bool PushEnabled bool
Card Card
Channel *Channel
} }
type TopicSlot struct { type TopicSlot struct {

View File

@ -173,8 +173,8 @@ func updateAsset(asset *store.Asset, status string, crc uint32, size int64) (err
// determine affected contact list // determine affected contact list
cards := make(map[string]store.Card) cards := make(map[string]store.Card)
for _, card := range topic.Channel.Cards { for _, member := range topic.Channel.Members {
cards[card.GUID] = card cards[member.Card.GUID] = member.Card
} }
for _, group := range topic.Channel.Groups { for _, group := range topic.Channel.Groups {
for _, card := range group.Cards { for _, card := range group.Cards {