|
|
@ -17,6 +17,8 @@ package group
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
pbconversation "github.com/OpenIMSDK/protocol/conversation"
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/protocol/wrapperspb"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/newmgo"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/newmgo"
|
|
|
|
tx2 "github.com/openimsdk/open-im-server/v3/pkg/common/db/tx"
|
|
|
|
tx2 "github.com/openimsdk/open-im-server/v3/pkg/common/db/tx"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient/grouphash"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient/grouphash"
|
|
|
@ -29,9 +31,6 @@ import (
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
|
|
|
|
|
|
|
|
|
|
|
|
pbconversation "github.com/OpenIMSDK/protocol/conversation"
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/protocol/wrapperspb"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/tools/mw/specialerror"
|
|
|
|
"github.com/OpenIMSDK/tools/mw/specialerror"
|
|
|
@ -875,11 +874,11 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbgroup.SetGroupInf
|
|
|
|
if err := s.PopulateGroupMember(ctx, owner); err != nil {
|
|
|
|
if err := s.PopulateGroupMember(ctx, owner); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data := UpdateGroupInfoMap(ctx, req.GroupInfoForSet)
|
|
|
|
update := UpdateGroupInfoMap(ctx, req.GroupInfoForSet)
|
|
|
|
if len(data) == 0 {
|
|
|
|
if len(update) == 0 {
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := s.db.UpdateGroup(ctx, group.GroupID, data); err != nil {
|
|
|
|
if err := s.db.UpdateGroup(ctx, group.GroupID, update); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
group, err = s.db.TakeGroup(ctx, req.GroupInfoForSet.GroupID)
|
|
|
|
group, err = s.db.TakeGroup(ctx, req.GroupInfoForSet.GroupID)
|
|
|
@ -894,10 +893,9 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbgroup.SetGroupInf
|
|
|
|
if opMember != nil {
|
|
|
|
if opMember != nil {
|
|
|
|
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
|
|
|
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var notified bool
|
|
|
|
num := len(update)
|
|
|
|
if len(data) == 1 {
|
|
|
|
if req.GroupInfoForSet.Notification != "" {
|
|
|
|
switch {
|
|
|
|
num--
|
|
|
|
case req.GroupInfoForSet.Notification != "":
|
|
|
|
|
|
|
|
func() {
|
|
|
|
func() {
|
|
|
|
conversation := &pbconversation.ConversationReq{
|
|
|
|
conversation := &pbconversation.ConversationReq{
|
|
|
|
ConversationID: msgprocessor.GetConversationIDBySessionType(constant.SuperGroupChatType, req.GroupInfoForSet.GroupID),
|
|
|
|
ConversationID: msgprocessor.GetConversationIDBySessionType(constant.SuperGroupChatType, req.GroupInfoForSet.GroupID),
|
|
|
@ -915,13 +913,12 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbgroup.SetGroupInf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
_ = s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
|
|
|
_ = s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
|
|
|
notified = true
|
|
|
|
|
|
|
|
case req.GroupInfoForSet.GroupName != "":
|
|
|
|
|
|
|
|
_ = s.Notification.GroupInfoSetNameNotification(ctx, &sdkws.GroupInfoSetNameTips{Group: tips.Group, OpUser: tips.OpUser})
|
|
|
|
|
|
|
|
notified = true
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.GroupName != "" {
|
|
|
|
|
|
|
|
num--
|
|
|
|
|
|
|
|
_ = s.Notification.GroupInfoSetNameNotification(ctx, &sdkws.GroupInfoSetNameTips{Group: tips.Group, OpUser: tips.OpUser})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !notified {
|
|
|
|
if num > 0 {
|
|
|
|
_ = s.Notification.GroupInfoSetNotification(ctx, tips)
|
|
|
|
_ = s.Notification.GroupInfoSetNotification(ctx, tips)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|