From 66e9929e92db10829772a59054c521d82abd28d3 Mon Sep 17 00:00:00 2001 From: luhaoling <2198702716@qq.com> Date: Fri, 26 Jan 2024 16:39:08 +0800 Subject: [PATCH] fix: fix the Manger judge condition --- internal/push/push_to_client.go | 4 ++-- internal/rpc/msg/revoke.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 6cf3f558b..246431015 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -228,10 +228,10 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws return err } log.ZInfo(ctx, "GroupDismissedNotificationInfo****", "groupID", groupID, "num", len(pushToUserIDs), "list", pushToUserIDs) - if len(config.Config.Manager.UserID) > 0 { + if config.Config.Manager.UserID[0] != "" { ctx = mcontext.WithOpUserIDContext(ctx, config.Config.Manager.UserID[0]) } - if len(config.Config.Manager.UserID) == 0 && len(config.Config.IMAdmin.UserID) > 0 { + if config.Config.Manager.UserID[0] == "" && len(config.Config.IMAdmin.UserID) > 0 { ctx = mcontext.WithOpUserIDContext(ctx, config.Config.IMAdmin.UserID[0]) } defer func(groupID string) { diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index 91ded4827..116bef4f7 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -112,10 +112,10 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg. } revokerUserID := mcontext.GetOpUserID(ctx) var flag bool - if len(config.Config.Manager.UserID) > 0 { + if config.Config.Manager.UserID[0] != "" { flag = utils.Contain(revokerUserID, config.Config.Manager.UserID...) } - if len(config.Config.Manager.UserID) == 0 { + if config.Config.Manager.UserID[0] == "" && len(config.Config.IMAdmin.UserID) > 0 { flag = utils.Contain(revokerUserID, config.Config.IMAdmin.UserID...) } tips := sdkws.RevokeMsgTips{