Validate conversation type

This commit is contained in:
lilia 2015-02-07 14:24:56 -10:00
parent 5e3ed1658b
commit fc3a600e72

View file

@ -39,6 +39,10 @@
var missing = _.filter(required, function(attr) { return !attributes[attr]; });
if (missing.length) { return "Conversation must have " + missing; }
if (attributes.type !== 'private' && attributes.type !== 'group') {
return "Invalid conversation type: " + attributes.type;
}
// hack
if (this.get('type') === 'private') {
this.id = libphonenumber.util.verifyNumber(this.id);