diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 9a6ed9592..035043de1 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -96,6 +96,17 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) { return true, 0, "" } +func userIsMuteInGroup(groupID, userID string) (bool, error) { + groupMemberInfo, err := rocksCache.GetGroupMemberInfoFromCache(groupID, userID) + if err != nil { + return false, utils.Wrap(err, "") + } + if groupMemberInfo.MuteEndTime.Unix() >= time.Now().Unix() { + return true, nil + } + return false, nil +} + func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) { switch data.MsgData.SessionType { case constant.SingleChatType: @@ -169,6 +180,14 @@ func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, s return false, 202, "you are not in group", nil } } + isMute, err := userIsMuteInGroup(data.MsgData.GroupID, data.MsgData.SendID) + if err != nil { + errMsg := data.OperationID + err.Error() + return false, 223, errMsg, nil + } + if isMute { + return false, 224, "you are muted", nil + } return true, 0, "", userIDList case constant.SuperGroupChatType: groupInfo, err := rocksCache.GetGroupInfoFromCache(data.MsgData.GroupID) @@ -222,6 +241,14 @@ func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, s return false, 202, "you are not in group", nil } } + isMute, err := userIsMuteInGroup(data.MsgData.GroupID, data.MsgData.SendID) + if err != nil { + errMsg := data.OperationID + err.Error() + return false, 223, errMsg, nil + } + if isMute { + return false, 224, "you are muted", nil + } return true, 0, "", userIDList } default: diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 1afebfa52..3d290e0d6 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -585,7 +585,7 @@ type usualConfig struct { Minio struct { AccessKeyID string `yaml:"accessKeyID"` SecretAccessKey string `yaml:"secretAccessKey"` - Endpoint string `yaml:"endPoint"` + Endpoint string `yaml:"endpoint"` } `yaml:"minio"` } `yaml:"credential"`