mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
mute member cant send msg
This commit is contained in:
parent
3c8a0bb011
commit
08a4b92f3a
@ -96,6 +96,17 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
|
|||||||
return true, 0, ""
|
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) {
|
func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
|
||||||
switch data.MsgData.SessionType {
|
switch data.MsgData.SessionType {
|
||||||
case constant.SingleChatType:
|
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
|
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
|
return true, 0, "", userIDList
|
||||||
case constant.SuperGroupChatType:
|
case constant.SuperGroupChatType:
|
||||||
groupInfo, err := rocksCache.GetGroupInfoFromCache(data.MsgData.GroupID)
|
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
|
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
|
return true, 0, "", userIDList
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -585,7 +585,7 @@ type usualConfig struct {
|
|||||||
Minio struct {
|
Minio struct {
|
||||||
AccessKeyID string `yaml:"accessKeyID"`
|
AccessKeyID string `yaml:"accessKeyID"`
|
||||||
SecretAccessKey string `yaml:"secretAccessKey"`
|
SecretAccessKey string `yaml:"secretAccessKey"`
|
||||||
Endpoint string `yaml:"endPoint"`
|
Endpoint string `yaml:"endpoint"`
|
||||||
} `yaml:"minio"`
|
} `yaml:"minio"`
|
||||||
} `yaml:"credential"`
|
} `yaml:"credential"`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user