Don't require a conversation name
Just display a sensible default in the frontend if it's unset. For private conversations this should be the phone number, for groups, the list of numbers.
This commit is contained in:
parent
ff259a7dee
commit
0ea176dfa0
3 changed files with 2 additions and 4 deletions
|
@ -141,7 +141,6 @@
|
|||
};
|
||||
} else {
|
||||
attributes = {
|
||||
name : source,
|
||||
type : 'private'
|
||||
};
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
defaults: function() {
|
||||
var timestamp = new Date().getTime();
|
||||
return {
|
||||
name : 'New Conversation',
|
||||
image : '/images/default.png',
|
||||
unreadCount : 0,
|
||||
timestamp : timestamp,
|
||||
|
@ -37,7 +36,7 @@
|
|||
},
|
||||
|
||||
validate: function(attributes, options) {
|
||||
var required = ['type', 'timestamp', 'image', 'name'];
|
||||
var required = ['type', 'timestamp', 'image'];
|
||||
var missing = _.filter(required, function(attr) { return !attributes[attr]; });
|
||||
if (missing.length) { return "Conversation must have " + missing; }
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ var Whisper = Whisper || {};
|
|||
render: function() {
|
||||
this.$el.html(
|
||||
Mustache.render(this.template, {
|
||||
contact_name: this.model.get('name'),
|
||||
contact_name: this.model.get('name') || this.model.get('members') || this.model.id,
|
||||
contact_avatar: this.model.get('image'),
|
||||
last_message: this.model.get('lastMessage'),
|
||||
last_message_timestamp: moment(this.model.get('timestamp')).format('MMM D')
|
||||
|
|
Loading…
Reference in a new issue