mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 20:30:40 +08:00
fix groupMuted send msg
This commit is contained in:
parent
ad2df2f36f
commit
6f22b37e1d
@ -70,7 +70,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
|||||||
wsResult = append(wsResult, reply.SinglePushResult...)
|
wsResult = append(wsResult, reply.SinglePushResult...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData)
|
log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData, "isOfflinePush", isOfflinePush)
|
||||||
successCount++
|
successCount++
|
||||||
if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID {
|
if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID {
|
||||||
// save invitation info for offline push
|
// save invitation info for offline push
|
||||||
|
@ -107,6 +107,17 @@ func userIsMuteInGroup(groupID, userID string) (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func groupIsMuted(groupID string) (bool, error) {
|
||||||
|
groupInfo, err := rocksCache.GetGroupInfoFromCache(groupID)
|
||||||
|
if err != nil {
|
||||||
|
return false, utils.Wrap(err, "GetGroupInfoFromCache failed")
|
||||||
|
}
|
||||||
|
if groupInfo.Status == constant.GroupStatusMuted {
|
||||||
|
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:
|
||||||
@ -182,7 +193,15 @@ 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)
|
isMute, err := groupIsMuted(data.MsgData.GroupID)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := data.OperationID + err.Error()
|
||||||
|
return false, 223, errMsg, nil
|
||||||
|
}
|
||||||
|
if isMute {
|
||||||
|
return false, 225, "group id muted", nil
|
||||||
|
}
|
||||||
|
isMute, err = userIsMuteInGroup(data.MsgData.GroupID, data.MsgData.SendID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := data.OperationID + err.Error()
|
errMsg := data.OperationID + err.Error()
|
||||||
return false, 223, errMsg, nil
|
return false, 223, errMsg, nil
|
||||||
@ -245,7 +264,15 @@ 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)
|
isMute, err := groupIsMuted(data.MsgData.GroupID)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := data.OperationID + err.Error()
|
||||||
|
return false, 223, errMsg, nil
|
||||||
|
}
|
||||||
|
if isMute {
|
||||||
|
return false, 225, "group id muted", nil
|
||||||
|
}
|
||||||
|
isMute, err = userIsMuteInGroup(data.MsgData.GroupID, data.MsgData.SendID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := data.OperationID + err.Error()
|
errMsg := data.OperationID + err.Error()
|
||||||
return false, 223, errMsg, nil
|
return false, 223, errMsg, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user