Skip to content

Commit

Permalink
refactor: conversation trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Jul 17, 2023
1 parent 5edcd9e commit 746cb9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/conversation_msg/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ func (c *Conversation) SyncConversationHashReadSeqs(ctx context.Context) error {
}
if err := c.db.UpdateColumnsConversation(ctx, conversationID, map[string]interface{}{"unread_count": unreadCount, "has_read_seq": v.HasReadSeq}); err != nil {
log.ZError(ctx, "UpdateColumnsConversation err", err, "conversationID", conversationID)
continue
}
conversationIDs = append(conversationIDs, conversationID)
}
log.ZDebug(ctx, "update conversations", "conversations", conversations)

common.TriggerCmdUpdateConversation(ctx, common.UpdateConNode{Action: constant.ConChange, Args: conversationIDs}, c.GetCh())
common.TriggerCmdUpdateConversation(ctx, common.UpdateConNode{Action: constant.TotalUnreadMessageChanged, Args: conversationIDs}, c.GetCh())
if len(conversationIDs) > 0 {
common.TriggerCmdUpdateConversation(ctx, common.UpdateConNode{Action: constant.ConChange, Args: conversationIDs}, c.GetCh())
common.TriggerCmdUpdateConversation(ctx, common.UpdateConNode{Action: constant.TotalUnreadMessageChanged, Args: conversationIDs}, c.GetCh())
}
return nil
}

0 comments on commit 746cb9e

Please sign in to comment.