mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 10:18:45 +08:00
fix: fix the valiable shadows problem
This commit is contained in:
parent
41eceaaf7a
commit
bd194bf09d
@ -118,7 +118,7 @@ func Start(config *config.GlobalConfig, client registry.SvcDiscoveryRegistry, se
|
|||||||
// ok.
|
// ok.
|
||||||
func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) {
|
func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) {
|
||||||
resp = &pbfriend.ApplyToAddFriendResp{}
|
resp = &pbfriend.ApplyToAddFriendResp{}
|
||||||
if err := authverify.CheckAccessV3(ctx, req.FromUserID, s.config); err != nil {
|
if err = authverify.CheckAccessV3(ctx, req.FromUserID, s.config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if req.ToUserID == req.FromUserID {
|
if req.ToUserID == req.FromUserID {
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
|||||||
if !authverify.IsAppManagerUid(ctx, m.config) {
|
if !authverify.IsAppManagerUid(ctx, m.config) {
|
||||||
switch msgs[0].SessionType {
|
switch msgs[0].SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
if err := authverify.CheckAccessV3(ctx, msgs[0].SendID, m.config); err != nil {
|
if err = authverify.CheckAccessV3(ctx, msgs[0].SendID, m.config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
role = user.AppMangerLevel
|
role = user.AppMangerLevel
|
||||||
@ -132,7 +132,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
|||||||
} else {
|
} else {
|
||||||
recvID = msgs[0].RecvID
|
recvID = msgs[0].RecvID
|
||||||
}
|
}
|
||||||
if err := m.notificationSender.NotificationWithSesstionType(ctx, req.UserID, recvID, constant.MsgRevokeNotification, msgs[0].SessionType, &tips); err != nil {
|
if err = m.notificationSender.NotificationWithSesstionType(ctx, req.UserID, recvID, constant.MsgRevokeNotification, msgs[0].SessionType, &tips); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err = CallbackAfterRevokeMsg(ctx, m.config, req); err != nil {
|
if err = CallbackAfterRevokeMsg(ctx, m.config, req); err != nil {
|
||||||
|
|||||||
@ -66,7 +66,7 @@ func (m *msgServer) sendMsgSuperGroupChat(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := callbackMsgModify(ctx, m.config, req); err != nil {
|
if err = callbackMsgModify(ctx, m.config, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForGroup(req.MsgData.GroupID), req.MsgData)
|
err = m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForGroup(req.MsgData.GroupID), req.MsgData)
|
||||||
@ -108,7 +108,7 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
|
|||||||
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
|
||||||
} else { //@Everyone and @other people
|
} else { //@Everyone and @other people
|
||||||
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe}
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe}
|
||||||
err := m.Conversation.SetConversations(ctx, atUserID, conversation)
|
err = m.Conversation.SetConversations(ctx, atUserID, conversation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZWarn(ctx, "SetConversations", err, "userID", atUserID, "conversation", conversation)
|
log.ZWarn(ctx, "SetConversations", err, "userID", atUserID, "conversation", conversation)
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ func (m *msgServer) sendMsgNotification(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq) (resp *pbmsg.SendMsgResp, err error) {
|
func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq) (resp *pbmsg.SendMsgResp, err error) {
|
||||||
if err := m.messageVerification(ctx, req); err != nil {
|
if err = m.messageVerification(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
isSend := true
|
isSend := true
|
||||||
@ -169,10 +169,10 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := callbackMsgModify(ctx, m.config, req); err != nil {
|
if err = callbackMsgModify(ctx, m.config, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForSingle(req.MsgData.SendID, req.MsgData.RecvID), req.MsgData); err != nil {
|
if err = m.MsgDatabase.MsgToMQ(ctx, utils.GenConversationUniqueKeyForSingle(req.MsgData.SendID, req.MsgData.RecvID), req.MsgData); err != nil {
|
||||||
prommetrics.SingleChatMsgProcessFailedCounter.Inc()
|
prommetrics.SingleChatMsgProcessFailedCounter.Inc()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -53,16 +52,16 @@ func (m *msgServer) addInterceptorHandler(interceptorFunc ...MessageInterceptorF
|
|||||||
m.Handlers = append(m.Handlers, interceptorFunc...)
|
m.Handlers = append(m.Handlers, interceptorFunc...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error {
|
//func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error {
|
||||||
for _, handler := range m.Handlers {
|
// for _, handler := range m.Handlers {
|
||||||
msgData, err := handler(ctx, config, req)
|
// msgData, err := handler(ctx, config, req)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
req.MsgData = msgData
|
// req.MsgData = msgData
|
||||||
}
|
// }
|
||||||
return nil
|
// return nil
|
||||||
}
|
//}
|
||||||
|
|
||||||
func Start(config *config.GlobalConfig, client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(config *config.GlobalConfig, client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
rdb, err := cache.NewRedis(config)
|
rdb, err := cache.NewRedis(config)
|
||||||
|
|||||||
@ -257,10 +257,10 @@ func (t *thirdServer) CompleteFormData(ctx context.Context, req *third.CompleteF
|
|||||||
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
|
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
|
||||||
}
|
}
|
||||||
var mate FormDataMate
|
var mate FormDataMate
|
||||||
if err := json.Unmarshal(data, &mate); err != nil {
|
if err = json.Unmarshal(data, &mate); err != nil {
|
||||||
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
|
return nil, errs.ErrArgs.Wrap("invalid id " + err.Error())
|
||||||
}
|
}
|
||||||
if err := checkUploadName(ctx, mate.Name, t.config); err != nil {
|
if err = checkUploadName(ctx, mate.Name, t.config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
info, err := t.s3dataBase.StatObject(ctx, mate.Key)
|
info, err := t.s3dataBase.StatObject(ctx, mate.Key)
|
||||||
@ -280,7 +280,7 @@ func (t *thirdServer) CompleteFormData(ctx context.Context, req *third.CompleteF
|
|||||||
Group: mate.Group,
|
Group: mate.Group,
|
||||||
CreateTime: time.Now(),
|
CreateTime: time.Now(),
|
||||||
}
|
}
|
||||||
if err := t.s3dataBase.SetObject(ctx, obj); err != nil {
|
if err = t.s3dataBase.SetObject(ctx, obj); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &third.CompleteFormDataResp{Url: t.apiAddress(mate.Name)}, nil
|
return &third.CompleteFormDataResp{Url: t.apiAddress(mate.Name)}, nil
|
||||||
|
|||||||
@ -56,7 +56,7 @@ func Start(config *config.GlobalConfig, client discoveryregistry.SvcDiscoveryReg
|
|||||||
if apiURL == "" {
|
if apiURL == "" {
|
||||||
return fmt.Errorf("api url is empty")
|
return fmt.Errorf("api url is empty")
|
||||||
}
|
}
|
||||||
if _, err := url.Parse(config.Object.ApiURL); err != nil {
|
if _, err = url.Parse(config.Object.ApiURL); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if apiURL[len(apiURL)-1] != '/' {
|
if apiURL[len(apiURL)-1] != '/' {
|
||||||
|
|||||||
@ -125,11 +125,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := CallbackBeforeUpdateUserInfo(ctx, s.config, req); err != nil {
|
if err = CallbackBeforeUpdateUserInfo(ctx, s.config, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
data := convert.UserPb2DBMap(req.UserInfo)
|
data := convert.UserPb2DBMap(req.UserInfo)
|
||||||
if err := s.UpdateByMap(ctx, req.UserInfo.UserID, data); err != nil {
|
if err = s.UpdateByMap(ctx, req.UserInfo.UserID, data); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_ = s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
|
_ = s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
|
||||||
@ -138,17 +138,17 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" {
|
if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" {
|
||||||
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
if err = s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
||||||
log.ZError(ctx, "NotificationUserInfoUpdate", err)
|
log.ZError(ctx, "NotificationUserInfoUpdate", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, friendID := range friends {
|
for _, friendID := range friends {
|
||||||
s.friendNotificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID)
|
s.friendNotificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID)
|
||||||
}
|
}
|
||||||
if err := CallbackAfterUpdateUserInfo(ctx, s.config, req); err != nil {
|
if err = CallbackAfterUpdateUserInfo(ctx, s.config, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
if err = s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
||||||
log.ZError(ctx, "NotificationUserInfoUpdate", err, "userID", req.UserInfo.UserID)
|
log.ZError(ctx, "NotificationUserInfoUpdate", err, "userID", req.UserInfo.UserID)
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user