From dcc6244fc2771453c5122119435c13c49b6bad0c Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sun, 4 Mar 2018 07:09:49 +0100 Subject: [PATCH] Don't overwrite default avatar with `undefined` --- src/converse-chatview.js | 1 + src/converse-core.js | 7 ++++--- src/templates/chatbox_head.html | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/converse-chatview.js b/src/converse-chatview.js index e826dcbd8..4a193d488 100644 --- a/src/converse-chatview.js +++ b/src/converse-chatview.js @@ -249,6 +249,7 @@ render () { this.el.innerHTML = tpl_chatbox_head( _.extend(this.model.toJSON(), { + '_converse': _converse, 'avatar_width': _converse.chatview_avatar_width, 'avatar_height': _converse.chatview_avatar_height, 'info_close': __('Close this chat box'), diff --git a/src/converse-core.js b/src/converse-core.js index 526265350..efc3925c4 100644 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -878,9 +878,10 @@ }, initialize (attributes) { - const { jid } = attributes; - const bare_jid = Strophe.getBareJidFromJid(jid).toLowerCase(); - const resource = Strophe.getResourceFromJid(jid); + const { jid } = attributes, + bare_jid = Strophe.getBareJidFromJid(jid).toLowerCase(), + resource = Strophe.getResourceFromJid(jid); + attributes.jid = bare_jid; this.set(_.assignIn({ 'fullname': bare_jid, diff --git a/src/templates/chatbox_head.html b/src/templates/chatbox_head.html index 8db254a65..42728dcdf 100644 --- a/src/templates/chatbox_head.html +++ b/src/templates/chatbox_head.html @@ -4,7 +4,7 @@ User Avatar + src="data:{{{o.image_type || o._converse.DEFAULT_IMAGE_TYPE}}};base64,{{{o.image || o._converse.DEFAULT_IMAGE}}}"/> {[ } ]}
{[ if (o.url) { ]}