Fix disappearing conversation bug

Opening two message-detail views in two separate conversations would
disappear one of the conversations. Fixed by better encapsulating the
sub-views of a conversation.

// FREEBIE
This commit is contained in:
lilia 2015-10-02 11:21:10 -07:00
parent 8f003ea69d
commit bbb5b24d6b
2 changed files with 8 additions and 12 deletions

View File

@ -23,6 +23,7 @@
<div class='conversation-stack'></div>
</script>
<script type='text/x-tmpl-mustache' id='conversation'>
<div class='panel'>
<div class='conversation-header'>
<div class='conversation-menu menu'>
<button class='drop-down'></button>
@ -54,6 +55,7 @@
<textarea class='send-message' placeholder="Send a message" rows="1"></textarea>
</form>
</div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='confirmation-dialog'>
<div class='message'>{{ message }}</div>

View File

@ -88,8 +88,6 @@
viewMembers: function() {
var view = new Whisper.GroupMemberList({ model: this.model });
this.$el.hide();
view.$el.insertAfter(this.el);
this.listenBack(view);
},
@ -120,9 +118,7 @@
textsecure.storage.axolotl.getIdentityKey(our_number).then(function(our_key) {
var view = new Whisper.KeyVerificationView({
model: { their_key: their_key, your_key: our_key }
});
this.$el.hide();
view.render().$el.insertAfter(this.el);
}).render();
this.listenBack(view);
}.bind(this));
}.bind(this));
@ -134,16 +130,16 @@
model: data.message,
conversation: this.model
});
view.$el.insertAfter(this.$el);
this.$el.hide();
view.render();
this.listenBack(view);
view.render();
},
listenBack: function(view) {
this.$('.panel').hide();
view.$el.prependTo(this.el);
this.listenToOnce(view, 'back', function(e) {
view.remove();
this.$el.show();
this.$('.panel').show();
this.$el.trigger('force-resize');
}.bind(this));
},
@ -173,8 +169,6 @@
model: this.model,
window: this.appWindow.contentWindow
});
this.newGroupUpdateView.$el.insertAfter(this.el);
this.$el.hide();
this.listenBack(this.newGroupUpdateView);
},
@ -250,7 +244,7 @@
},
isHidden: function() {
return (this.$el.css('display') === 'none');
return (this.$el.css('display') === 'none') || this.$('.panel').css('display') === 'none';
}
});
})();