mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-01-08 21:07:01 +08:00
fix: reset user conversation seq when rejoining group to resolve message recall issue
This commit is contained in:
parent
d385fdd0aa
commit
1ad1e77fe3
@ -455,6 +455,9 @@ func (g *groupServer) InviteUserToGroup(ctx context.Context, req *pbgroup.Invite
|
||||
if err = g.notification.GroupApplicationAgreeMemberEnterNotification(ctx, req.GroupID, req.SendMessage, opUserID, req.InvitedUserIDs...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := g.setMemberJoinSeq(ctx, req.GroupID, req.InvitedUserIDs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pbgroup.InviteUserToGroupResp{}, nil
|
||||
}
|
||||
|
||||
@ -836,6 +839,9 @@ func (g *groupServer) GroupApplicationResponse(ctx context.Context, req *pbgroup
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if err := g.setMemberJoinSeq(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
case constant.GroupResponseRefuse:
|
||||
g.notification.GroupApplicationRejectedNotification(ctx, req)
|
||||
@ -898,6 +904,9 @@ func (g *groupServer) JoinGroup(ctx context.Context, req *pbgroup.JoinGroupReq)
|
||||
if err = g.notification.MemberEnterNotification(ctx, req.GroupID, req.InviterUserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := g.setMemberJoinSeq(ctx, req.GroupID, []string{req.InviterUserID}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
g.webhookAfterJoinGroup(ctx, &g.config.WebhooksConfig.AfterJoinGroup, req)
|
||||
|
||||
return &pbgroup.JoinGroupResp{}, nil
|
||||
@ -959,6 +968,18 @@ func (g *groupServer) deleteMemberAndSetConversationSeq(ctx context.Context, gro
|
||||
return g.conversationClient.SetConversationMaxSeq(ctx, conversationID, userIDs, maxSeq)
|
||||
}
|
||||
|
||||
func (g *groupServer) setMemberJoinSeq(ctx context.Context, groupID string, userIDs []string) error {
|
||||
conversationID := msgprocessor.GetConversationIDBySessionType(constant.ReadGroupChatType, groupID)
|
||||
maxSeq, err := g.msgClient.GetConversationMaxSeq(ctx, conversationID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := g.conversationClient.SetConversationMinSeq(ctx, conversationID, userIDs, maxSeq+1); err != nil {
|
||||
return err
|
||||
}
|
||||
return g.msgClient.SetUserConversationMaxSeq(ctx, conversationID, userIDs, 0)
|
||||
}
|
||||
|
||||
func (g *groupServer) SetGroupInfo(ctx context.Context, req *pbgroup.SetGroupInfoReq) (*pbgroup.SetGroupInfoResp, error) {
|
||||
var opMember *model.GroupMember
|
||||
if !authverify.IsAppManagerUid(ctx, g.config.Share.IMAdminUserID) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user