Skip to content

Commit c328d39

Browse files
authored
Merge pull request #2889 from openimsdk/cherry-pick-cbade46
deps: Merge #2881 #2883 #2884 #2885 PRs into release-v3.8.2
2 parents 687b2eb + 7d51797 commit c328d39

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

internal/rpc/msg/as_read.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,23 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
181181
req.UserID, seqs, hasReadSeq)
182182
}
183183

184-
reqCall := &cbapi.CallbackGroupMsgReadReq{
185-
SendID: conversation.OwnerUserID,
186-
ReceiveID: req.UserID,
187-
UnreadMsgNum: req.HasReadSeq,
188-
ContentType: int64(conversation.ConversationType),
184+
if conversation.ConversationType == constant.SingleChatType {
185+
reqCall := &cbapi.CallbackSingleMsgReadReq{
186+
ConversationID: conversation.ConversationID,
187+
UserID: conversation.OwnerUserID,
188+
Seqs: req.Seqs,
189+
ContentType: conversation.ConversationType,
190+
}
191+
m.webhookAfterSingleMsgRead(ctx, &m.config.WebhooksConfig.AfterSingleMsgRead, reqCall)
192+
} else if conversation.ConversationType == constant.ReadGroupChatType {
193+
reqCall := &cbapi.CallbackGroupMsgReadReq{
194+
SendID: conversation.OwnerUserID,
195+
ReceiveID: req.UserID,
196+
UnreadMsgNum: req.HasReadSeq,
197+
ContentType: int64(conversation.ConversationType),
198+
}
199+
m.webhookAfterGroupMsgRead(ctx, &m.config.WebhooksConfig.AfterGroupMsgRead, reqCall)
189200
}
190-
191-
m.webhookAfterGroupMsgRead(ctx, &m.config.WebhooksConfig.AfterGroupMsgRead, reqCall)
192201
return &msg.MarkConversationAsReadResp{}, nil
193202
}
194203

internal/rpc/msg/send.go

-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq
174174
prommetrics.SingleChatMsgProcessFailedCounter.Inc()
175175
return nil, nil
176176
} else {
177-
if err = m.webhookBeforeSendSingleMsg(ctx, &m.config.WebhooksConfig.BeforeSendSingleMsg, req); err != nil {
178-
return nil, err
179-
}
180177
if err := m.webhookBeforeMsgModify(ctx, &m.config.WebhooksConfig.BeforeMsgModify, req); err != nil {
181178
return nil, err
182179
}

internal/rpc/msg/verify.go

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe
5959
data.MsgData.ContentType >= constant.NotificationBegin {
6060
return nil
6161
}
62+
if err := m.webhookBeforeSendSingleMsg(ctx, &m.config.WebhooksConfig.BeforeSendSingleMsg, data); err != nil {
63+
return err
64+
}
6265
black, err := m.FriendLocalCache.IsBlack(ctx, data.MsgData.SendID, data.MsgData.RecvID)
6366
if err != nil {
6467
return err

pkg/common/storage/cache/redis/conversation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
func NewConversationRedis(rdb redis.UniversalClient, localCache *config.LocalCache, opts *rockscache.Options, db database.Conversation) cache.ConversationCache {
3939
batchHandler := NewBatchDeleterRedis(rdb, opts, []string{localCache.Conversation.Topic})
4040
c := localCache.Conversation
41-
log.ZDebug(context.Background(), "black local cache init", "Topic", c.Topic, "SlotNum", c.SlotNum, "SlotSize", c.SlotSize, "enable", c.Enable())
41+
log.ZDebug(context.Background(), "conversation local cache init", "Topic", c.Topic, "SlotNum", c.SlotNum, "SlotSize", c.SlotSize, "enable", c.Enable())
4242
return &ConversationRedisCache{
4343
BatchDeleter: batchHandler,
4444
rcClient: rockscache.NewClient(rdb, *opts),

pkg/common/storage/controller/msg.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID strin
444444
}
445445
successMsgs = append(mongoMsgs, successMsgs...)
446446

447-
_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
448-
if err != nil {
449-
return 0, 0, nil, err
450-
}
447+
//_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
448+
//if err != nil {
449+
// return 0, 0, nil, err
450+
//}
451451
}
452452

453453
return minSeq, maxSeq, successMsgs, nil
@@ -506,10 +506,10 @@ func (db *commonMsgDatabase) GetMsgBySeqs(ctx context.Context, userID string, co
506506

507507
successMsgs = append(successMsgs, mongoMsgs...)
508508

509-
_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
510-
if err != nil {
511-
return 0, 0, nil, err
512-
}
509+
//_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
510+
//if err != nil {
511+
// return 0, 0, nil, err
512+
//}
513513
}
514514
return minSeq, maxSeq, successMsgs, nil
515515
}

0 commit comments

Comments
 (0)