From fc3a600e72ea0679d4621fa3d3fa276ad706a936 Mon Sep 17 00:00:00 2001 From: lilia Date: Sat, 7 Feb 2015 14:24:56 -1000 Subject: [PATCH] Validate conversation type --- js/models/conversations.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/models/conversations.js b/js/models/conversations.js index cfe30a81..34128936 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -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);