mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 11:06:43 +08:00
GroupInfoSetAnnouncementTips GroupInfoSetNameTips
This commit is contained in:
parent
1f0aca8441
commit
95cbf28b99
@ -26,7 +26,6 @@ import (
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||
pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
@ -926,21 +925,34 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
} else {
|
||||
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
||||
}
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
var num int
|
||||
if req.GroupInfoForSet.Notification != "" {
|
||||
args := &pbConversation.ModifyConversationFieldReq{
|
||||
Conversation: &pbConversation.Conversation{
|
||||
OwnerUserID: mcontext.GetOpUserID(ctx),
|
||||
ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
||||
ConversationType: constant.SuperGroupChatType,
|
||||
GroupID: group.GroupID,
|
||||
},
|
||||
FieldType: constant.FieldGroupAtType,
|
||||
UserIDList: userIDs,
|
||||
}
|
||||
if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil {
|
||||
log.ZWarn(ctx, "modifyConversationField failed", err, "args", args)
|
||||
num++
|
||||
s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||
//args := &pbConversation.ModifyConversationFieldReq{
|
||||
// Conversation: &pbConversation.Conversation{
|
||||
// OwnerUserID: mcontext.GetOpUserID(ctx),
|
||||
// ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
||||
// ConversationType: constant.SuperGroupChatType,
|
||||
// GroupID: group.GroupID,
|
||||
// },
|
||||
// FieldType: constant.FieldGroupAtType,
|
||||
// UserIDList: userIDs,
|
||||
//}
|
||||
//if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil {
|
||||
// log.ZWarn(ctx, "modifyConversationField failed", err, "args", args)
|
||||
//}
|
||||
}
|
||||
switch len(data) - num {
|
||||
case 0:
|
||||
case 1:
|
||||
if req.GroupInfoForSet.GroupName == "" {
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
} else {
|
||||
s.Notification.GroupInfoSetNameNotification(ctx, &sdkws.GroupInfoSetNameTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||
}
|
||||
default:
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ const (
|
||||
GroupMemberInfoSetNotification = 1516
|
||||
GroupMemberSetToAdminNotification = 1517
|
||||
GroupMemberSetToOrdinaryUserNotification = 1518
|
||||
GroupInfoSetAnnouncementNotification = 1519
|
||||
GroupInfoSetNameNotification = 1520
|
||||
|
||||
SignalingNotificationBegin = 1600
|
||||
SignalingNotification = 1601
|
||||
|
@ -10,5 +10,4 @@ protoc --go_out=plugins=grpc:./rtc --go_opt=module=github.com/OpenIMSDK/Open-IM-
|
||||
protoc --go_out=plugins=grpc:./sdkws --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws sdkws/sdkws.proto
|
||||
protoc --go_out=plugins=grpc:./third --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third third/third.proto
|
||||
protoc --go_out=plugins=grpc:./user --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user user/user.proto
|
||||
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
|
||||
protoc --go_out=plugins=grpc:./office --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office office/office.proto
|
||||
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
|
File diff suppressed because it is too large
Load Diff
@ -233,6 +233,16 @@ message GroupInfoSetTips{
|
||||
GroupInfo group = 3;
|
||||
}
|
||||
|
||||
message GroupInfoSetNameTips{
|
||||
GroupMemberFullInfo opUser = 1; //who do this
|
||||
GroupInfo group = 2;
|
||||
}
|
||||
|
||||
message GroupInfoSetAnnouncementTips{
|
||||
GroupMemberFullInfo opUser = 1; //who do this
|
||||
GroupInfo group = 2;
|
||||
}
|
||||
|
||||
// OnJoinGroupApplication()
|
||||
message JoinGroupApplicationTips{
|
||||
GroupInfo group = 1;
|
||||
|
@ -289,55 +289,23 @@ func (g *GroupNotificationSender) mergeGroupFull(ctx context.Context, groupID st
|
||||
return groupInfo, nil
|
||||
}
|
||||
|
||||
//func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, group *relation.GroupModel, members []*relation.GroupMemberModel, userMap map[string]*sdkws.UserInfo) (err error) {
|
||||
// defer log.ZDebug(ctx, "GroupCreatedNotification.return")
|
||||
// defer func() {
|
||||
// if err != nil {
|
||||
// log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
||||
// }
|
||||
// }()
|
||||
// groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, &userMap)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupCreatedNotification, groupInfo)
|
||||
//}
|
||||
|
||||
func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, tips *sdkws.GroupCreatedTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupCreatedNotification, tips)
|
||||
}
|
||||
|
||||
//func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, group *relation.GroupModel, members []*relation.GroupMemberModel, needVerification *int32) (err error) {
|
||||
// groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, nil)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// tips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
|
||||
// if needVerification != nil {
|
||||
// tips.Group.NeedVerification = *needVerification
|
||||
// }
|
||||
// return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupInfoSetNotification, tips)
|
||||
//}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, tips *sdkws.GroupInfoSetTips) (err error) {
|
||||
//groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, nil)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//tips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
|
||||
//if needVerification != nil {
|
||||
// tips.Group.NeedVerification = *needVerification
|
||||
//}
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Context, tips *sdkws.GroupInfoSetNameTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNameNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx context.Context, tips *sdkws.GroupInfoSetAnnouncementTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetAnnouncementNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) (err error) {
|
||||
defer log.ZDebug(ctx, "return")
|
||||
defer func() {
|
||||
if err != nil {
|
||||
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
||||
}
|
||||
}()
|
||||
group, err := g.getGroupInfo(ctx, req.GroupID)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -377,22 +345,12 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, re
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//userIDs, err := g.getGroupOwnerAndAdminUserID(ctx, req.GroupID)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
|
||||
GroupID: group.GroupID,
|
||||
UserID: user.UserID,
|
||||
Nickname: user.Nickname,
|
||||
FaceURL: user.FaceURL,
|
||||
}}
|
||||
//for _, userID := range append(userIDs, opUserID) {
|
||||
// err = g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), userID, constant.MemberQuitNotification, tips)
|
||||
// if err != nil {
|
||||
// log.ZError(ctx, "MemberQuitNotification failed", err, "group", req.GroupID, "userID", userID)
|
||||
// }
|
||||
//}
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), req.GroupID, constant.MemberQuitNotification, tips)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user