3
0

Extra channel type-check on creation

This commit is contained in:
Denis Arh
2019-09-09 03:13:56 +02:00
parent 15c003fe3c
commit fd0c6a3dea
+4
View File
@@ -233,6 +233,10 @@ func (svc *channel) FindMembers(channelID uint64) (out types.ChannelMemberSet, e
}
func (svc *channel) Create(in *types.Channel) (out *types.Channel, err error) {
if !in.Type.IsValid() {
return nil, errors.Errorf("invalid channel type")
}
if len(in.Name) == 0 && in.Type != types.ChannelTypeGroup {
return nil, errors.New("channel name not provided")
}