diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index 962283eb9..94caa5e2a 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -48,9 +48,8 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq { newContent = params.Content["revokeMsgClientID"].(string) default: } - var options map[string]bool + options := make(map[string]bool, 5) if params.IsOnlineOnly { - options = make(map[string]bool, 5) utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false) utils.SetSwitchFromOptions(options, constant.IsHistory, false) utils.SetSwitchFromOptions(options, constant.IsPersistent, false) diff --git a/pkg/utils/map.go b/pkg/utils/map.go index fc24cc87d..66ca27471 100644 --- a/pkg/utils/map.go +++ b/pkg/utils/map.go @@ -116,6 +116,9 @@ func JsonStringToMap(str string) (tempMap map[string]int32) { return tempMap } func GetSwitchFromOptions(Options map[string]bool, key string) (result bool) { + if Options == nil { + return true + } if flag, ok := Options[key]; !ok || flag { return true }