From 0ea176dfa0f40a82d169358f3812f6d316b798f0 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 24 Dec 2014 14:22:25 -0800 Subject: [PATCH] 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. --- js/background.js | 1 - js/models/conversations.js | 3 +-- js/views/conversation_list_item_view.js | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/js/background.js b/js/background.js index f4f04ec7..ecccb3d7 100644 --- a/js/background.js +++ b/js/background.js @@ -141,7 +141,6 @@ }; } else { attributes = { - name : source, type : 'private' }; } diff --git a/js/models/conversations.js b/js/models/conversations.js index bc5890af..812e7d07 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -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; } }, diff --git a/js/views/conversation_list_item_view.js b/js/views/conversation_list_item_view.js index ea31f8dc..1f167d80 100644 --- a/js/views/conversation_list_item_view.js +++ b/js/views/conversation_list_item_view.js @@ -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')