Cleanup inbox view

Don't auto open the last conversation. It doesn't make sense now that we
no longer have two column layout.

Don't trigger/listen for selected events. There's no need since the list
item opens a new popup now.
This commit is contained in:
lilia 2015-01-21 23:29:19 -10:00
parent 607d5d3307
commit 34d5f3e88a
2 changed files with 2 additions and 22 deletions

View file

@ -20,7 +20,6 @@ var Whisper = Whisper || {};
'use strict'; 'use strict';
var bg = extension.windows.getBackground(); var bg = extension.windows.getBackground();
// list of conversations, showing user/group and last message sent // list of conversations, showing user/group and last message sent
Whisper.ConversationListItemView = Backbone.View.extend({ Whisper.ConversationListItemView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
@ -39,17 +38,8 @@ var Whisper = Whisper || {};
}, },
open: function(e) { open: function(e) {
var modelId = this.model.id;
this.$el.addClass('selected'); this.$el.addClass('selected');
bg.openConversation(this.model.id);
if (!this.view) {
this.view = new Whisper.ConversationView({ model: this.model });
}
bg.openConversation(modelId);
this.model.collection.trigger('selected', this.view);
}, },
render: function() { render: function() {

View file

@ -30,23 +30,13 @@
collection : this.conversations collection : this.conversations
}); });
this.conversations.fetchActive({reset: true}).then(function() { this.conversations.fetchActive({reset: true});
if (this.conversations.length) {
this.conversations.at(0).trigger('open');
}
}.bind(this));
extension.on('message', function(message) { extension.on('message', function(message) {
this.conversations.fetch({id: message.conversationId}).then(function() { this.conversations.fetch({id: message.conversationId}).then(function() {
this.conversations.get(message.conversationId).fetchMessages(); this.conversations.get(message.conversationId).fetchMessages();
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
this.conversations.on('selected', function(view) {
$('.conversation').hide().trigger('close'); // detach any existing conversation views
this.setContent(view.$el.show());
view.render();
}, this);
}, },
events: { events: {
'click #new-message': 'new_message', 'click #new-message': 'new_message',