You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/rpc/msg/utils.go

38 lines
817 B

2 years ago
package msg
import (
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
2 years ago
"github.com/go-redis/redis/v8"
"gorm.io/gorm"
2 years ago
)
func isMessageHasReadEnabled(msgData *sdkws.MsgData) bool {
switch msgData.ContentType {
case constant.HasReadReceipt:
if config.Config.SingleMessageHasReadReceiptEnable {
return true
} else {
return false
}
case constant.GroupHasReadReceipt:
if config.Config.GroupMessageHasReadReceiptEnable {
return true
} else {
return false
}
2 years ago
}
return true
2 years ago
}
2 years ago
func IsNotFound(err error) bool {
switch utils.Unwrap(err) {
case redis.Nil, gorm.ErrRecordNotFound:
return true
default:
return false
}
}