Bläddra i källkod

Don't show MUC domain if `locked_muc_domain` is set to `'hidden'`

JC Brand 6 år sedan
förälder
incheckning
616731b323
4 ändrade filer med 20 tillägg och 4 borttagningar
  1. 11 2
      dist/converse.js
  2. 5 1
      docs/source/configuration.rst
  3. 1 0
      src/converse-muc-views.js
  4. 3 1
      src/templates/chatroom_head.html

+ 11 - 2
dist/converse.js

@@ -54467,6 +54467,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins
         /* Returns the heading HTML to be rendered.
          */
         return templates_chatroom_head_html__WEBPACK_IMPORTED_MODULE_16___default()(_.extend(this.model.toJSON(), {
+          '_converse': _converse,
           'Strophe': Strophe,
           'info_close': __('Close and leave this groupchat'),
           'info_configure': __('Configure this groupchat'),
@@ -93495,12 +93496,20 @@ var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./no
 module.exports = function(o) {
 var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
 function print() { __p += __j.call(arguments, '') }
-__p += '<!-- src/templates/chatroom_head.html -->\n<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>\n<div class="chatbox-title">\n    <div class="chat-title" title="' +
+__p += '<!-- src/templates/chatroom_head.html -->\n<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>\n<div class="chatbox-title">\n    <div class="chat-title" ';
+ if (o._converse.locked_muc_domain !== 'hidden') { ;
+__p += ' title="' +
 __e(o.jid) +
-'">\n        ';
+'" ';
+ } ;
+__p += ' >\n        ';
  if (o.name && o.name !== o.Strophe.getNodeFromJid(o.jid)) { ;
 __p += '\n            ' +
 __e( o.name ) +
+'\n        ';
+ } else if (o._converse.locked_muc_domain === 'hidden') { ;
+__p += '\n            ' +
+__e( o.Strophe.getNodeFromJid(o.jid) ) +
 '\n        ';
  } else { ;
 __p += '\n            ' +

+ 5 - 1
docs/source/configuration.rst

@@ -882,10 +882,14 @@ locked_muc_domain
 -----------------
 
 * Default: ``false``
+* Allowed values: ``false``, ``true``, ``'hidden'``
 
-This setting allows you to restrict the multi-user chat (MUC) domain to only the value
+By setting this value to something truthy, you restrict the multi-user chat (MUC) domain to only the value
 specified in `muc_domain`_.
 
+If the value is set to `'hidden'` (which is also truthy), then the MUC domain
+will not be shown to users.
+
 locked_muc_nickname
 -------------------
 

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

@@ -694,6 +694,7 @@ converse.plugins.add('converse-muc-views', {
                  */
                 return tpl_chatroom_head(
                     _.extend(this.model.toJSON(), {
+                        '_converse': _converse,
                         'Strophe': Strophe,
                         'info_close': __('Close and leave this groupchat'),
                         'info_configure': __('Configure this groupchat'),

+ 3 - 1
src/templates/chatroom_head.html

@@ -1,8 +1,10 @@
 <div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>
 <div class="chatbox-title">
-    <div class="chat-title" title="{{{o.jid}}}">
+    <div class="chat-title" {[ if (o._converse.locked_muc_domain !== 'hidden') { ]} title="{{{o.jid}}}" {[ } ]} >
         {[ if (o.name && o.name !== o.Strophe.getNodeFromJid(o.jid)) { ]}
             {{{ o.name }}}
+        {[ } else if (o._converse.locked_muc_domain === 'hidden') { ]}
+            {{{ o.Strophe.getNodeFromJid(o.jid) }}}
         {[ } else { ]}
             {{{ o.Strophe.getNodeFromJid(o.jid) }}}@{{{ o.Strophe.getDomainFromJid(o.jid) }}}
         {[ } ]}