mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
unread bug fix
This commit is contained in:
parent
0f655e9292
commit
10c0f3075a
@ -30,6 +30,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||
resp := &pbConversation.ModifyConversationFieldResp{}
|
||||
var err error
|
||||
isSyncConversation := true
|
||||
if req.Conversation.ConversationType == constant.GroupChatType {
|
||||
groupInfo, err := imdb.GetGroupInfoByGroupID(req.Conversation.GroupID)
|
||||
if err != nil {
|
||||
@ -71,8 +72,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
|
||||
case constant.FieldAttachedInfo:
|
||||
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"attached_info": conversation.AttachedInfo})
|
||||
case constant.FieldUnread:
|
||||
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"unread_count": conversation.UnreadCount})
|
||||
|
||||
isSyncConversation = false
|
||||
}
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "UpdateColumnsConversations error", err.Error())
|
||||
@ -97,9 +97,16 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
|
||||
return resp, nil
|
||||
}
|
||||
} else {
|
||||
for _, v := range req.UserIDList {
|
||||
chat.ConversationChangeNotification(req.OperationID, v)
|
||||
if isSyncConversation {
|
||||
for _, v := range req.UserIDList {
|
||||
chat.ConversationChangeNotification(req.OperationID, v)
|
||||
}
|
||||
} else {
|
||||
for _, v := range req.UserIDList {
|
||||
chat.ConversationUnreadChangeNotification(req.OperationID, v, req.Conversation.ConversationID)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
|
||||
resp.CommonResp = &pbConversation.CommonResp{}
|
||||
|
@ -68,3 +68,15 @@ func ConversationChangeNotification(operationID, userID string) {
|
||||
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
|
||||
SetConversationNotification(operationID, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, tips)
|
||||
}
|
||||
|
||||
//会话未读数同步
|
||||
func ConversationUnreadChangeNotification(operationID, userID, conversationID string) {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName())
|
||||
ConversationChangedTips := &open_im_sdk.ConversationUpdateTips{
|
||||
UserID: userID,
|
||||
ConversationIDList: []string{conversationID},
|
||||
}
|
||||
var tips open_im_sdk.TipsComm
|
||||
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
|
||||
SetConversationNotification(operationID, userID, userID, constant.ConversationUnreadNotification, ConversationChangedTips, tips)
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ func Notification(n *NotificationMsg) {
|
||||
unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount
|
||||
case constant.DeleteMessageNotification:
|
||||
reliabilityLevel = constant.ReliableNotificationNoMsg
|
||||
case constant.SuperGroupUpdateNotification:
|
||||
case constant.SuperGroupUpdateNotification, constant.ConversationUnreadNotification:
|
||||
reliabilityLevel = constant.UnreliableNotification
|
||||
}
|
||||
switch reliabilityLevel {
|
||||
|
@ -103,6 +103,7 @@ const (
|
||||
SuperGroupNotificationEnd = 1699
|
||||
|
||||
ConversationPrivateChatNotification = 1701
|
||||
ConversationUnreadNotification = 1702
|
||||
|
||||
OrganizationChangedNotification = 1801
|
||||
|
||||
|
@ -487,6 +487,7 @@ message UserInfoUpdatedTips{
|
||||
//////////////////////conversation/////////////////////
|
||||
message ConversationUpdateTips{
|
||||
string UserID = 1;
|
||||
repeated string conversationIDList = 2;
|
||||
}
|
||||
|
||||
message ConversationSetPrivateTips{
|
||||
|
Loading…
x
Reference in New Issue
Block a user