Skip to content

Commit 2d84abd

Browse files
committed
update setConversation logic.
1 parent dddcca3 commit 2d84abd

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

internal/rpc/conversation/conversaion.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,6 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
315315
}
316316
}
317317

318-
if len(m) != 0 {
319-
if err := c.conversationDatabase.SetUsersConversationFieldTx(ctx, req.UserIDs, &conversation, m); err != nil {
320-
return nil, err
321-
}
322-
}
323-
324318
if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.ReadGroupChatType {
325319
var conversations []*dbModel.Conversation
326320
for _, ownerUserID := range req.UserIDs {
@@ -338,12 +332,19 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
338332
c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID,
339333
req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID)
340334
}
341-
}
335+
} else {
336+
if len(m) != 0 {
337+
if err := c.conversationDatabase.SetUsersConversationFieldTx(ctx, req.UserIDs, &conversation, m); err != nil {
338+
return nil, err
339+
}
342340

343-
if unequal > 0 {
344-
for _, v := range req.UserIDs {
345-
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
341+
if unequal > 0 {
342+
for _, v := range req.UserIDs {
343+
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
344+
}
345+
}
346346
}
347+
347348
}
348349

349350
return &pbconversation.SetConversationsResp{}, nil

0 commit comments

Comments
 (0)