agreed re: priority.

FYI: The convention is to return nothing if the model is valid, and return
something (could be an object or whatever) if there are errors.


On Tue, May 27, 2014 at 11:59 AM, codedust <notifications@github.com> wrote:

> In js/models/threads.js:
>
> > +      return {
> > +        image: '/images/default.png',
> > +        unreadCount: 0,
> > +        timestamp: new Date().getTime()
> > +      };
> > +    },
> > +
> > +    validate: function(attributes, options) {
> > +      var required = ['id', 'type', 'recipients', 'timestamp', 'image', 'name'];
> > +      var missing = _.filter(required, function(attr) { return !attributes[attr]; });
> > +      if (missing.length) { return "Thread must have " + missing; }
> > +      if (attributes.recipients.length === 0) {
> > +        return "No recipients for thread " + this.id;
> > +      }
> > +      for (var person in attributes.recipients) {
> > +        if (!person) return "Invalid recipient";
>
> I'm not really familiar with Backbone. The returned strings made me think
> it was debug code.
> I will write this on my todo list but other things have priority.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/WhisperSystems/TextSecure-Browser/pull/38/files#r13095435>
> .
>