GroupInfoSetAnnouncementTips GroupInfoSetNameTips

test-errcode
withchao 1 year ago
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/common/tokenverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "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" 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/proto/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
@ -926,21 +925,34 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
} else { } else {
tips.OpUser = s.groupMemberDB2PB(opMember, 0) tips.OpUser = s.groupMemberDB2PB(opMember, 0)
} }
s.Notification.GroupInfoSetNotification(ctx, tips) var num int
if req.GroupInfoForSet.Notification != "" { if req.GroupInfoForSet.Notification != "" {
args := &pbConversation.ModifyConversationFieldReq{ num++
Conversation: &pbConversation.Conversation{ s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
OwnerUserID: mcontext.GetOpUserID(ctx), //args := &pbConversation.ModifyConversationFieldReq{
ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID), // Conversation: &pbConversation.Conversation{
ConversationType: constant.SuperGroupChatType, // OwnerUserID: mcontext.GetOpUserID(ctx),
GroupID: group.GroupID, // ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
}, // ConversationType: constant.SuperGroupChatType,
FieldType: constant.FieldGroupAtType, // GroupID: group.GroupID,
UserIDList: userIDs, // },
} // FieldType: constant.FieldGroupAtType,
if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil { // UserIDList: userIDs,
log.ZWarn(ctx, "modifyConversationField failed", err, "args", args) //}
//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 return resp, nil
} }

@ -70,6 +70,8 @@ const (
GroupMemberInfoSetNotification = 1516 GroupMemberInfoSetNotification = 1516
GroupMemberSetToAdminNotification = 1517 GroupMemberSetToAdminNotification = 1517
GroupMemberSetToOrdinaryUserNotification = 1518 GroupMemberSetToOrdinaryUserNotification = 1518
GroupInfoSetAnnouncementNotification = 1519
GroupInfoSetNameNotification = 1520
SignalingNotificationBegin = 1600 SignalingNotificationBegin = 1600
SignalingNotification = 1601 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:./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:./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:./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:./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

File diff suppressed because it is too large Load Diff

@ -233,6 +233,16 @@ message GroupInfoSetTips{
GroupInfo group = 3; 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() // OnJoinGroupApplication()
message JoinGroupApplicationTips{ message JoinGroupApplicationTips{
GroupInfo group = 1; GroupInfo group = 1;

@ -289,55 +289,23 @@ func (g *GroupNotificationSender) mergeGroupFull(ctx context.Context, groupID st
return groupInfo, nil 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) { 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) 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) { 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) 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) { 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) group, err := g.getGroupInfo(ctx, req.GroupID)
if err != nil { if err != nil {
return err return err
@ -377,22 +345,12 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, re
if err != nil { if err != nil {
return err return err
} }
//userIDs, err := g.getGroupOwnerAndAdminUserID(ctx, req.GroupID)
//if err != nil {
// return err
//}
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{ tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
GroupID: group.GroupID, GroupID: group.GroupID,
UserID: user.UserID, UserID: user.UserID,
Nickname: user.Nickname, Nickname: user.Nickname,
FaceURL: user.FaceURL, 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) return g.Notification(ctx, mcontext.GetOpUserID(ctx), req.GroupID, constant.MemberQuitNotification, tips)
} }

Loading…
Cancel
Save