mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-31 08:29:33 +08:00 
			
		
		
		
	Merge pull request #2889 from openimsdk/cherry-pick-cbade46
deps: Merge #2881 #2883 #2884 #2885 PRs into release-v3.8.2
This commit is contained in:
		
						commit
						c328d39cae
					
				| @ -181,14 +181,23 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon | |||||||
| 			req.UserID, seqs, hasReadSeq) | 			req.UserID, seqs, hasReadSeq) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	reqCall := &cbapi.CallbackGroupMsgReadReq{ | 	if conversation.ConversationType == constant.SingleChatType { | ||||||
| 		SendID:       conversation.OwnerUserID, | 		reqCall := &cbapi.CallbackSingleMsgReadReq{ | ||||||
| 		ReceiveID:    req.UserID, | 			ConversationID: conversation.ConversationID, | ||||||
| 		UnreadMsgNum: req.HasReadSeq, | 			UserID:         conversation.OwnerUserID, | ||||||
| 		ContentType:  int64(conversation.ConversationType), | 			Seqs:           req.Seqs, | ||||||
|  | 			ContentType:    conversation.ConversationType, | ||||||
|  | 		} | ||||||
|  | 		m.webhookAfterSingleMsgRead(ctx, &m.config.WebhooksConfig.AfterSingleMsgRead, reqCall) | ||||||
|  | 	} else if conversation.ConversationType == constant.ReadGroupChatType { | ||||||
|  | 		reqCall := &cbapi.CallbackGroupMsgReadReq{ | ||||||
|  | 			SendID:       conversation.OwnerUserID, | ||||||
|  | 			ReceiveID:    req.UserID, | ||||||
|  | 			UnreadMsgNum: req.HasReadSeq, | ||||||
|  | 			ContentType:  int64(conversation.ConversationType), | ||||||
|  | 		} | ||||||
|  | 		m.webhookAfterGroupMsgRead(ctx, &m.config.WebhooksConfig.AfterGroupMsgRead, reqCall) | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	m.webhookAfterGroupMsgRead(ctx, &m.config.WebhooksConfig.AfterGroupMsgRead, reqCall) |  | ||||||
| 	return &msg.MarkConversationAsReadResp{}, nil | 	return &msg.MarkConversationAsReadResp{}, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -174,9 +174,6 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq | |||||||
| 		prommetrics.SingleChatMsgProcessFailedCounter.Inc() | 		prommetrics.SingleChatMsgProcessFailedCounter.Inc() | ||||||
| 		return nil, nil | 		return nil, nil | ||||||
| 	} else { | 	} else { | ||||||
| 		if err = m.webhookBeforeSendSingleMsg(ctx, &m.config.WebhooksConfig.BeforeSendSingleMsg, req); err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 		if err := m.webhookBeforeMsgModify(ctx, &m.config.WebhooksConfig.BeforeMsgModify, req); err != nil { | 		if err := m.webhookBeforeMsgModify(ctx, &m.config.WebhooksConfig.BeforeMsgModify, req); err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -59,6 +59,9 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe | |||||||
| 			data.MsgData.ContentType >= constant.NotificationBegin { | 			data.MsgData.ContentType >= constant.NotificationBegin { | ||||||
| 			return nil | 			return nil | ||||||
| 		} | 		} | ||||||
|  | 		if err := m.webhookBeforeSendSingleMsg(ctx, &m.config.WebhooksConfig.BeforeSendSingleMsg, data); err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
| 		black, err := m.FriendLocalCache.IsBlack(ctx, data.MsgData.SendID, data.MsgData.RecvID) | 		black, err := m.FriendLocalCache.IsBlack(ctx, data.MsgData.SendID, data.MsgData.RecvID) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ const ( | |||||||
| func NewConversationRedis(rdb redis.UniversalClient, localCache *config.LocalCache, opts *rockscache.Options, db database.Conversation) cache.ConversationCache { | func NewConversationRedis(rdb redis.UniversalClient, localCache *config.LocalCache, opts *rockscache.Options, db database.Conversation) cache.ConversationCache { | ||||||
| 	batchHandler := NewBatchDeleterRedis(rdb, opts, []string{localCache.Conversation.Topic}) | 	batchHandler := NewBatchDeleterRedis(rdb, opts, []string{localCache.Conversation.Topic}) | ||||||
| 	c := localCache.Conversation | 	c := localCache.Conversation | ||||||
| 	log.ZDebug(context.Background(), "black local cache init", "Topic", c.Topic, "SlotNum", c.SlotNum, "SlotSize", c.SlotSize, "enable", c.Enable()) | 	log.ZDebug(context.Background(), "conversation local cache init", "Topic", c.Topic, "SlotNum", c.SlotNum, "SlotSize", c.SlotSize, "enable", c.Enable()) | ||||||
| 	return &ConversationRedisCache{ | 	return &ConversationRedisCache{ | ||||||
| 		BatchDeleter:   batchHandler, | 		BatchDeleter:   batchHandler, | ||||||
| 		rcClient:       rockscache.NewClient(rdb, *opts), | 		rcClient:       rockscache.NewClient(rdb, *opts), | ||||||
|  | |||||||
| @ -444,10 +444,10 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID strin | |||||||
| 		} | 		} | ||||||
| 		successMsgs = append(mongoMsgs, successMsgs...) | 		successMsgs = append(mongoMsgs, successMsgs...) | ||||||
| 
 | 
 | ||||||
| 		_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs) | 		//_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs) | ||||||
| 		if err != nil { | 		//if err != nil { | ||||||
| 			return 0, 0, nil, err | 		//	return 0, 0, nil, err | ||||||
| 		} | 		//} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return minSeq, maxSeq, successMsgs, nil | 	return minSeq, maxSeq, successMsgs, nil | ||||||
| @ -506,10 +506,10 @@ func (db *commonMsgDatabase) GetMsgBySeqs(ctx context.Context, userID string, co | |||||||
| 
 | 
 | ||||||
| 		successMsgs = append(successMsgs, mongoMsgs...) | 		successMsgs = append(successMsgs, mongoMsgs...) | ||||||
| 
 | 
 | ||||||
| 		_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs) | 		//_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs) | ||||||
| 		if err != nil { | 		//if err != nil { | ||||||
| 			return 0, 0, nil, err | 		//	return 0, 0, nil, err | ||||||
| 		} | 		//} | ||||||
| 	} | 	} | ||||||
| 	return minSeq, maxSeq, successMsgs, nil | 	return minSeq, maxSeq, successMsgs, nil | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user