From 7b0e9df41e3e2a50d7635648929917c7d5e3e0cc Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 4 Jun 2020 14:27:51 +0200 Subject: [PATCH] New config option: show_message_avatar --- CHANGES.md | 1 + docs/source/configuration.rst | 59 +++++++++++++++++++++-------------- src/components/message.js | 6 +++- src/converse-chatview.js | 1 + 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 86954b22d..f59143d43 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -42,6 +42,7 @@ Soon we'll deprecate the latter, so prepare now. - New config option [modtools_disable_query](https://conversejs.org/docs/html/configuration.html#modtools-disable-query) - New config option [muc_hats_from_vcard](https://conversejs.org/docs/html/configuration.html#muc-hats-from-vcard). - New config option [muc_send_probes](https://conversejs.org/docs/html/configuration.html#muc-send-probes). +- New config option [show_message_avatar](https://conversejs.org/docs/html/configuration.html#show-message-avatar). ## 6.0.0 (2020-01-09) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index a33ca8b7e..6f3940203 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -1592,30 +1592,6 @@ For example: Valid values are ``'active', 'composing', 'gone' 'inactive', 'paused'`` -show_images_inline ------------------- - -* Default: ``true`` - -If set to false, images won't be rendered in chats, instead only their links will be shown. - - -singleton ---------- - -* Default: ``false`` - -If set to ``true``, then only one chat (one-on-one or groupchat) will be allowed. - -The chat must be specified with the `auto_join_rooms`_ or `auto_join_private_chats`_ options. - -This setting is useful together with `view_mode`_ set to ``embedded``, when you -want to embed a chat into the page. - -Alternatively you could use it with `view_mode`_ set to ``overlayed`` to create -a single helpdesk-type chat. - - show_chat_state_notifications ----------------------------- @@ -1669,6 +1645,23 @@ not fulfilled. Requires the `src/converse-notification.js` plugin. + +show_message_avatar +------------------- + +* Default: ``true`` + +Whether chat messages should also render the author's avatar. + + +show_images_inline +------------------ + +* Default: ``true`` + +If set to ``false``, images won't be rendered in chats, instead only their links will be shown. + + show_retraction_warning ----------------------- @@ -1698,6 +1691,24 @@ Adds a button to the chat which can be clicked or tapped in order to send the message. +singleton +--------- + +* Default: ``false`` + +If set to ``true``, then only one chat (one-on-one or groupchat) will be allowed. + +The chat must be specified with the `auto_join_rooms`_ or `auto_join_private_chats`_ options. + +This setting is useful together with `view_mode`_ set to ``embedded``, when you +want to embed a chat into the page. + +Alternatively you could use it with `view_mode`_ set to ``overlayed`` to create +a single helpdesk-type chat. + + + + smacks_max_unacked_stanzas -------------------------- diff --git a/src/components/message.js b/src/components/message.js index cc728d780..6523dd5ee 100644 --- a/src/components/message.js +++ b/src/components/message.js @@ -132,7 +132,7 @@ class Message extends CustomElement { ${this.isFollowup() ? 'chat-msg--followup' : ''}" data-isodate="${this.time}" data-msgid="${this.msgid}" data-from="${this.from}" data-encrypted="${this.is_encrypted}"> - ${ (this.is_me_message || this.type === 'headline') ? '' : renderAvatar(this.getAvatarData()) } + ${ this.shouldShowAvatar() ? renderAvatar(this.getAvatarData()) : '' }
${ (this.is_me_message) ? html` @@ -165,6 +165,10 @@ class Message extends CustomElement {
`; } + shouldShowAvatar () { + return api.settings.get('show_message_avatar') && !this.is_me_message && this.type !== 'headline'; + } + getAvatarData () { const image_type = this.model.vcard.get('image_type'); const image_data = this.model.vcard.get('image'); diff --git a/src/converse-chatview.js b/src/converse-chatview.js index f187c9dff..43ac585c6 100644 --- a/src/converse-chatview.js +++ b/src/converse-chatview.js @@ -56,6 +56,7 @@ converse.plugins.add('converse-chatview', { 'message_limit': 0, 'muc_hats_from_vcard': false, 'show_images_inline': true, + 'show_message_avatar': true, 'show_retraction_warning': true, 'show_send_button': true, 'show_toolbar': true,