Browse Source

fix rendering of `muc_roomid_policy_hint`

Christoph Scholz 5 years ago
parent
commit
f78a1372e3
3 changed files with 6 additions and 5 deletions
  1. 2 1
      CHANGES.md
  2. 1 2
      src/converse-muc-views.js
  3. 3 2
      src/templates/add_chatroom_modal.js

+ 2 - 1
CHANGES.md

@@ -18,9 +18,10 @@ Soon we'll deprecate the latter, so prepare now.
     and [muc_roomid_policy_hint](https://conversejs.org/docs/html/configuration.html#muc-roomid-policy-hint)
 - #1826: A user can now add himself as a contact
 - #1839: Headline messages are shown in controlbox
-- #1896: Don't send receipts for messages fetched from the archive 
+- #1896: Don't send receipts for messages fetched from the archive
 - #1937: Editing a message removes the mentions highlight
 - #1963: Mentions are visually incorrect when used in message replies
+- #2002: fix rendering of `muc_roomid_policy_hint`
 - Allow ignoring of bootstrap modules at build using environment variable. For xample: `export BOOTSTRAP_IGNORE_MODULES="Modal,Dropdown" && make dist`
 - Bugfix. Handle stanza that clears the MUC subject
 - Replace Backbone with [Skeletor](https://github.com/skeletorjs/skeletor)

+ 1 - 2
src/converse-muc-views.js

@@ -33,7 +33,6 @@ import tpl_muc_sidebar from "templates/muc_sidebar.js";
 import tpl_room_description from "templates/room_description.html";
 import tpl_room_panel from "templates/room_panel.html";
 import tpl_spinner from "templates/spinner.html";
-import xss from "xss/dist/xss";
 
 const { Strophe, sizzle, $iq, $pres } = converse.env;
 const u = converse.env.utils;
@@ -543,7 +542,7 @@ converse.plugins.add('converse-muc-views', {
                     'label_room_address': _converse.muc_domain ? __('Groupchat name') :  __('Groupchat address'),
                     'chatroom_placeholder': placeholder,
                     'muc_roomid_policy_error_msg': this.muc_roomid_policy_error_msg,
-                    'muc_roomid_policy_hint': xss.filterXSS(_converse.muc_roomid_policy_hint, {'whiteList': {b: [], br: [], em: []}})
+                    'muc_roomid_policy_hint': _converse.muc_roomid_policy_hint
                 }));
             },
 

+ 3 - 2
src/templates/add_chatroom_modal.js

@@ -1,7 +1,8 @@
 import { html } from "lit-html";
+import { unsafeHTML } from "lit-html/directives/unsafe-html.js";
 import { __ } from '@converse/headless/i18n';
 import { modal_header_close_button } from "./buttons"
-
+import xss from "xss/dist/xss";
 
 const i18n_join = __('Join');
 const i18n_enter = __('Enter a new Groupchat');
@@ -32,7 +33,7 @@ export default (o) => html`
                         ${ (o.muc_roomid_policy_error_msg) ? html`<label class="roomid-policy-error">${o.muc_roomid_policy_error_msg}</label>` : '' }
                         <input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="${o.chatroom_placeholder}"/>
                     </div>
-                    ${ o.muc_roomid_policy_hint ?  html`<div class="form-group">{{o.muc_roomid_policy_hint}}</div>` : '' }
+                    ${ o.muc_roomid_policy_hint ?  html`<div class="form-group">${unsafeHTML(xss.filterXSS(o.muc_roomid_policy_hint, {'whiteList': {b: [], br: [], em: []}}))}</div>` : '' }
                     ${ !o._converse.locked_muc_nickname ? nickname_input(o) : '' }
                     <input type="submit" class="btn btn-primary" name="join" value="${i18n_join || ''}" ?disabled=${o.muc_roomid_policy_error_msg}>
                 </form>