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

View file

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