ソースを参照

New config option: show_message_avatar

JC Brand 5 年 前
コミット
7b0e9df41e
4 ファイル変更42 行追加25 行削除
  1. 1 0
      CHANGES.md
  2. 35 24
      docs/source/configuration.rst
  3. 5 1
      src/components/message.js
  4. 1 0
      src/converse-chatview.js

+ 1 - 0
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)
 

+ 35 - 24
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
 --------------------------
 

+ 5 - 1
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()) : '' }
                 <div class="chat-msg__content chat-msg__content--${this.sender} ${this.is_me_message ? 'chat-msg__content--action' : ''}">
                     <span class="chat-msg__heading">
                         ${ (this.is_me_message) ? html`
@@ -165,6 +165,10 @@ class Message extends CustomElement {
             </div>`;
     }
 
+    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');

+ 1 - 0
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,