From 4ee2652367a8b8ed6014c030e2b34281c022e740 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 5 Oct 2016 22:31:27 +0900 Subject: [PATCH] Fix wrong contact in some timer updates Mistakenly showed 'You' for timer updates inferred from incoming messages. --- js/models/messages.js | 11 +++++++++++ js/views/message_view.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/models/messages.js b/js/models/messages.js index efa967fb..cb11c3bd 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -120,6 +120,17 @@ id: this.get('conversationId') }); }, + getExpirationTimerUpdateSource: function() { + if (this.isExpirationTimerUpdate()) { + var conversationId = this.get('expirationTimerUpdate').source; + var c = ConversationController.get(conversationId); + if (!c) { + c = ConversationController.create({id: conversationId, type: 'private'}); + c.fetch(); + } + return c; + } + }, getContact: function() { var conversationId = this.get('source'); if (!this.isIncoming()) { diff --git a/js/views/message_view.js b/js/views/message_view.js index 6e2691f7..1e078a65 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -51,7 +51,7 @@ return this.model.id; }, initialize: function() { - this.conversation = this.model.getContact(); + this.conversation = this.model.getExpirationTimerUpdateSource(); this.listenTo(this.conversation, 'change', this.render); }, render_attributes: function() {