Browse Source

Bugfix. In a MUC the `/help` command didn't render properly

JC Brand 7 năm trước cách đây
mục cha
commit
a4a1c80b5b
3 tập tin đã thay đổi với 9 bổ sung5 xóa
  1. 1 0
      CHANGES.md
  2. 7 4
      src/converse-chatview.js
  3. 1 1
      src/templates/help_message.html

+ 1 - 0
CHANGES.md

@@ -17,6 +17,7 @@
 - The way the archive ID of a MAM message is specified, has changed.
   See https://xmpp.org/extensions/xep-0313.html#archives_id
 - Fixed error building DOM toggle_chats.html span.unread-message-count class attribute
+- Bugfix. In a MUC the `/help` command didn't render properly.
 
 ### New Features
 - #314 Add support for opening chat rooms with a URL fragment such as `#converse/room?jid=room@domain`

+ 7 - 4
src/converse-chatview.js

@@ -554,10 +554,13 @@
 
                 showHelpMessages (msgs, type, spinner) {
                     _.each(msgs, (msg) => {
-                        this.$content.append($(tpl_help_message({
-                            'type': type||'info',
-                            'message': msgs
-                        })));
+                        this.content.insertAdjacentHTML(
+                            'beforeend',
+                            tpl_help_message({
+                                'type': type||'info',
+                                'message': xss.filterXSS(msg, {'whiteList': {'strong': []}})
+                            })
+                        );
                     });
                     if (spinner === true) {
                         this.$content.append(tpl_spinner);

+ 1 - 1
src/templates/help_message.html

@@ -1 +1 @@
-<div class="chat-{{{o.type}}}">{{{o.message}}}</div>
+<div class="chat-{{{o.type}}}">{{o.message}}</div>