Bugfix. Error messages don't have associated vcards

This commit is contained in:
JC Brand 2018-10-02 18:04:03 +02:00
parent ba37826d44
commit 148eaeacf5
3 changed files with 15 additions and 6 deletions

11
dist/converse.js vendored
View File

@ -60321,7 +60321,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
},
setVCard() {
if (this.get('type') === 'groupchat') {
if (this.get('type') === 'error') {
return;
} else if (this.get('type') === 'groupchat') {
this.vcard = this.getVCardForChatroomOccupant();
} else {
const jid = this.get('from');
@ -67523,7 +67525,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
},
initialize() {
this.model.vcard.on('change', this.render, this);
if (this.model.vcard) {
this.model.vcard.on('change', this.render, this);
}
this.model.on('change:correcting', this.onMessageCorrection, this);
this.model.on('change:message', this.render, this);
this.model.on('change:progress', this.renderFileUploadProgresBar, this);
@ -67575,7 +67580,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
renderChatMessage() {
const is_me_message = this.isMeCommand(),
moment_time = moment(this.model.get('time')),
role = this.model.vcard.get('role'),
role = this.model.vcard ? this.model.vcard.get('role') : null,
roles = role ? role.split(',') : [];
const msg = u.stringToElement(tpl_message(_.extend(this.model.toJSON(), {
'__': __,

View File

@ -109,7 +109,9 @@
},
setVCard () {
if (this.get('type') === 'groupchat') {
if (this.get('type') === 'error') {
return;
} else if (this.get('type') === 'groupchat') {
this.vcard = this.getVCardForChatroomOccupant();
} else {
const jid = this.get('from');

View File

@ -58,7 +58,9 @@
},
initialize () {
this.model.vcard.on('change', this.render, this);
if (this.model.vcard) {
this.model.vcard.on('change', this.render, this);
}
this.model.on('change:correcting', this.onMessageCorrection, this);
this.model.on('change:message', this.render, this);
this.model.on('change:progress', this.renderFileUploadProgresBar, this);
@ -105,7 +107,7 @@
renderChatMessage () {
const is_me_message = this.isMeCommand(),
moment_time = moment(this.model.get('time')),
role = this.model.vcard.get('role'),
role = this.model.vcard ? this.model.vcard.get('role') : null,
roles = role ? role.split(',') : [];
const msg = u.stringToElement(tpl_message(