Skip to content

Commit

Permalink
Fix: don't show avatars for followup messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Nov 19, 2021
1 parent afbb46b commit 78846ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/shared/chat/templates/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { shouldRenderMediaFromURL } from '@converse/headless/utils/url.js';

export default (el, o) => {
const i18n_new_messages = __('New messages');
const is_followup = el.model.isFollowup();
return html`
${ o.is_first_unread ? html`<div class="message separator"><hr class="separator"><span class="separator-text">${ i18n_new_messages }</span></div>` : '' }
<div class="message chat-msg ${ el.getExtraMessageClasses() }"
Expand All @@ -18,7 +19,7 @@ export default (el, o) => {
<!-- Anchor to allow us to scroll the message into view -->
<a id="${o.msgid}"></a>
${ o.should_show_avatar ?
${ (o.should_show_avatar && !is_followup) ?
html`<a class="show-msg-author-modal" @click=${el.showUserModal}>
<converse-avatar
class="avatar align-self-center"
Expand All @@ -28,14 +29,14 @@ export default (el, o) => {
</a>` : '' }
<div class="chat-msg__content chat-msg__content--${o.sender} ${o.is_me_message ? 'chat-msg__content--action' : ''}">
${ !o.is_me_message ? html`
${ (!o.is_me_message && !is_followup) ? html`
<span class="chat-msg__heading">
<span class="chat-msg__author"><a class="show-msg-author-modal" @click=${el.showUserModal}>${o.username}</a></span>
${ o.hats.map(h => html`<span class="badge badge-secondary">${h.title}</span>`) }
<time timestamp="${el.model.get('edited') || el.model.get('time')}" class="chat-msg__time">${o.pretty_time}</time>
${ o.is_encrypted ? html`<span class="fa fa-lock"></span>` : '' }
</span>` : '' }
<div class="chat-msg__body chat-msg__body--${o.message_type} ${o.received ? 'chat-msg__body--received' : '' } ${o.is_delayed ? 'chat-msg__body--delayed' : '' }">
<div class="chat-msg__message">
${ (o.is_me_message) ? html`
Expand Down
12 changes: 2 additions & 10 deletions src/shared/styles/messages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,6 @@
}
}

.chat-msg__avatar {
margin-top: 0.5em;
vertical-align: middle;
height: var(--message-avatar-height);
width: var(--message-avatar-width);
min-height: var(--message-avatar-height);
min-width: var(--message-avatar-width);
}

.chat-msg__author {
overflow: hidden;
text-overflow: ellipsis;
Expand Down Expand Up @@ -295,10 +286,11 @@

&.chat-msg--followup {
.chat-msg__heading,
.chat-msg__avatar {
.show-msg-author-modal {
display: none;
}
&.chat-msg--with-avatar .chat-msg__content {
margin-left: 2.75rem;
width: 100%;
}
}
Expand Down

0 comments on commit 78846ab

Please sign in to comment.