Commit d895c7fc authored by JC Brand's avatar JC Brand

Bugfix. Leave space between classes

parent 149fcf5d
...@@ -218,11 +218,11 @@ ...@@ -218,11 +218,11 @@
type: 'groupchat' type: 'groupchat'
}).c('body').t('I wrote this message!').tree(); }).c('body').t('I wrote this message!').tree();
await view.model.onMessage(msg); await view.model.onMessage(msg);
await u.waitUntil(() => view.el.querySelectorAll('.chat-msg').length);
expect(view.model.messages.last().occupant.get('affiliation')).toBe('owner'); expect(view.model.messages.last().occupant.get('affiliation')).toBe('owner');
expect(view.model.messages.last().occupant.get('role')).toBe('moderator'); expect(view.model.messages.last().occupant.get('role')).toBe('moderator');
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1); expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(sizzle('.chat-msg', view.el).pop().classList.value.trim()).toBe('message chat-msg groupchat moderator owner'); expect(sizzle('.chat-msg', view.el).pop().classList.value.trim()).toBe('message chat-msg groupchat moderator owner');
let presence = $pres({ let presence = $pres({
to:'romeo@montague.lit/orchard', to:'romeo@montague.lit/orchard',
from:'lounge@montague.lit/romeo', from:'lounge@montague.lit/romeo',
......
...@@ -297,7 +297,7 @@ converse.plugins.add('converse-message-view', { ...@@ -297,7 +297,7 @@ converse.plugins.add('converse-message-view', {
getRetractionText () { getRetractionText () {
const username = this.model.getDisplayName(); const username = this.model.getDisplayName();
let retraction_text = __('A message by %1$s has been retracted', username); let retraction_text = __('%1$s has retracted this message', username);
if (this.model.get('type') === 'groupchat') { if (this.model.get('type') === 'groupchat') {
const retracted_by_mod = this.model.get('moderated_by'); const retracted_by_mod = this.model.get('moderated_by');
if (retracted_by_mod) { if (retracted_by_mod) {
...@@ -382,18 +382,19 @@ converse.plugins.add('converse-message-view', { ...@@ -382,18 +382,19 @@ converse.plugins.add('converse-message-view', {
]; ];
if (this.model.get('type') === 'groupchat') { if (this.model.get('type') === 'groupchat') {
if (this.model.occupant) { if (this.model.occupant) {
extra_classes += ` ${this.model.occupant.get('role') || ''} ${this.model.occupant.get('affiliation') || ''}`; extra_classes.push(this.model.occupant.get('role'));
extra_classes.push(this.model.occupant.get('affiliation'));
} }
if (this.model.get('sender') === 'them' && this.model.collection.chatbox.isUserMentioned(this.model)) { if (this.model.get('sender') === 'them' && this.model.collection.chatbox.isUserMentioned(this.model)) {
// Add special class to mark groupchat messages // Add special class to mark groupchat messages
// in which we are mentioned. // in which we are mentioned.
extra_classes += ' mentioned'; extra_classes.push('mentioned');
} }
} }
if (this.model.get('correcting')) { if (this.model.get('correcting')) {
extra_classes += ' correcting'; extra_classes.push('correcting');
} }
return extra_classes; return extra_classes.filter(c => c).join(" ");
} }
}); });
} }
......
<div class="message chat-msg {{{o.type}}}{[ if (o.is_me_message) { ]} chat-msg--action {[ } ]}{{{o.extra_classes}}}" <div class="message chat-msg {{{o.type}}} {{{o.extra_classes}}} {[ if (o.is_me_message) { ]} chat-msg--action {[ } ]}"
data-isodate="{{{o.time}}}" data-msgid="{{{o.msgid}}}" data-from="{{{o.from}}}" data-encrypted="{{{o.is_encrypted}}}"> data-isodate="{{{o.time}}}" data-msgid="{{{o.msgid}}}" data-from="{{{o.from}}}" data-encrypted="{{{o.is_encrypted}}}">
{[ if (o.type !== 'headline' && !o.is_me_message) { ]} {[ if (o.type !== 'headline' && !o.is_me_message) { ]}
<canvas class="avatar chat-msg__avatar" height="36" width="36"></canvas> <canvas class="avatar chat-msg__avatar" height="36" width="36"></canvas>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment