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 {
|
} else {
|
||||||
attributes = {
|
attributes = {
|
||||||
name : source,
|
|
||||||
type : 'private'
|
type : 'private'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
var timestamp = new Date().getTime();
|
var timestamp = new Date().getTime();
|
||||||
return {
|
return {
|
||||||
name : 'New Conversation',
|
|
||||||
image : '/images/default.png',
|
image : '/images/default.png',
|
||||||
unreadCount : 0,
|
unreadCount : 0,
|
||||||
timestamp : timestamp,
|
timestamp : timestamp,
|
||||||
|
@ -37,7 +36,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
validate: function(attributes, options) {
|
validate: function(attributes, options) {
|
||||||
var required = ['type', 'timestamp', 'image', 'name'];
|
var required = ['type', 'timestamp', 'image'];
|
||||||
var missing = _.filter(required, function(attr) { return !attributes[attr]; });
|
var missing = _.filter(required, function(attr) { return !attributes[attr]; });
|
||||||
if (missing.length) { return "Conversation must have " + missing; }
|
if (missing.length) { return "Conversation must have " + missing; }
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,7 @@ var Whisper = Whisper || {};
|
||||||
render: function() {
|
render: function() {
|
||||||
this.$el.html(
|
this.$el.html(
|
||||||
Mustache.render(this.template, {
|
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'),
|
contact_avatar: this.model.get('image'),
|
||||||
last_message: this.model.get('lastMessage'),
|
last_message: this.model.get('lastMessage'),
|
||||||
last_message_timestamp: moment(this.model.get('timestamp')).format('MMM D')
|
last_message_timestamp: moment(this.model.get('timestamp')).format('MMM D')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue