mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-25 20:52:11 +08:00
feat: GroupApplicationAgreeMemberEnterNotification splitting, rpc body size limit
This commit is contained in:
parent
14b669f296
commit
0c63223aa5
@ -448,13 +448,26 @@ func (g *groupServer) InviteUserToGroup(ctx context.Context, req *pbgroup.Invite
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := g.db.CreateGroup(ctx, nil, groupMembers); err != nil {
|
const singleQuantity = 50
|
||||||
|
for start := 0; start < len(groupMembers); start += singleQuantity {
|
||||||
|
end := start + singleQuantity
|
||||||
|
if end > len(groupMembers) {
|
||||||
|
end = len(groupMembers)
|
||||||
|
}
|
||||||
|
currentMembers := groupMembers[start:end]
|
||||||
|
|
||||||
|
if err := g.db.CreateGroup(ctx, nil, currentMembers); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = g.notification.GroupApplicationAgreeMemberEnterNotification(ctx, req.GroupID, req.SendMessage, opUserID, req.InvitedUserIDs...); err != nil {
|
userIDs := datautil.Slice(currentMembers, func(e *model.GroupMember) string {
|
||||||
|
return e.UserID
|
||||||
|
})
|
||||||
|
|
||||||
|
if err = g.notification.GroupApplicationAgreeMemberEnterNotification(ctx, req.GroupID, req.SendMessage, opUserID, userIDs...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return &pbgroup.InviteUserToGroupResp{}, nil
|
return &pbgroup.InviteUserToGroupResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -522,17 +522,7 @@ func (g *NotificationSender) MemberKickedNotification(ctx context.Context, tips
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *NotificationSender) GroupApplicationAgreeMemberEnterNotification(ctx context.Context, groupID string, SendMessage *bool, invitedOpUserID string, entrantUserID ...string) error {
|
func (g *NotificationSender) GroupApplicationAgreeMemberEnterNotification(ctx context.Context, groupID string, SendMessage *bool, invitedOpUserID string, entrantUserID ...string) error {
|
||||||
const singleQuantity = 50
|
return g.groupApplicationAgreeMemberEnterNotification(ctx, groupID, SendMessage, invitedOpUserID, entrantUserID...)
|
||||||
for start := 0; start < len(entrantUserID); start += singleQuantity {
|
|
||||||
end := start + singleQuantity
|
|
||||||
if end > len(entrantUserID) {
|
|
||||||
end = len(entrantUserID)
|
|
||||||
}
|
|
||||||
if err := g.groupApplicationAgreeMemberEnterNotification(ctx, groupID, SendMessage, invitedOpUserID, entrantUserID[start:end]...); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *NotificationSender) groupApplicationAgreeMemberEnterNotification(ctx context.Context, groupID string, SendMessage *bool, invitedOpUserID string, entrantUserID ...string) error {
|
func (g *NotificationSender) groupApplicationAgreeMemberEnterNotification(ctx context.Context, groupID string, SendMessage *bool, invitedOpUserID string, entrantUserID ...string) error {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user