Răsfoiți Sursa

Don't maximize minimized rooms when calling `rooms.open`

JC Brand 8 ani în urmă
părinte
comite
9edc97101b
4 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  1. 1 0
      docs/CHANGES.md
  2. 2 0
      docs/source/developer_api.rst
  3. 2 1
      src/converse-minimize.js
  4. 3 0
      src/converse-muc.js

+ 1 - 0
docs/CHANGES.md

@@ -18,6 +18,7 @@
   initialization is complete. [jcbrand]
   initialization is complete. [jcbrand]
 - New event ['reconnecting'](https://conversejs.org/docs/html/development.html#reconnecting) [jcbrand]
 - New event ['reconnecting'](https://conversejs.org/docs/html/development.html#reconnecting) [jcbrand]
 - New configuration setting [allow_bookmarks](https://conversejs.org/docs/html/configuration.html#allow_bookmarks) [jcbrand]
 - New configuration setting [allow_bookmarks](https://conversejs.org/docs/html/configuration.html#allow_bookmarks) [jcbrand]
+- The `rooms.open` API method will no longer maximize rooms that are minimized (unless `maximize: true` is passed in). [jcbrand]
 
 
 ## 2.0.1 (2016-11-07)
 ## 2.0.1 (2016-11-07)
 - #203 New configuration setting [muc_domain](https://conversejs.org/docs/html/configuration.html#muc_domain) [jcbrand]
 - #203 New configuration setting [muc_domain](https://conversejs.org/docs/html/configuration.html#muc_domain) [jcbrand]

+ 2 - 0
docs/source/developer_api.rst

@@ -578,6 +578,8 @@ Room attributes that may be passed in:
   For a list of configuration values that can be passed in, refer to these values
   For a list of configuration values that can be passed in, refer to these values
   in the `XEP-0045 MUC specification <http://xmpp.org/extensions/xep-0045.html#registrar-formtype-owner>`_.
   in the `XEP-0045 MUC specification <http://xmpp.org/extensions/xep-0045.html#registrar-formtype-owner>`_.
   The values should be named without the ``muc#roomconfig_`` prefix.
   The values should be named without the ``muc#roomconfig_`` prefix.
+* *maximize*: A boolean, indicating whether minimized rooms should also be
+  maximized, when opened. Set to ``false`` by default.
 
 
 For example, opening a room with a specific default configuration:
 For example, opening a room with a specific default configuration:
 
 

+ 2 - 1
src/converse-minimize.js

@@ -196,7 +196,8 @@
                     /* Find the chat box and show it. If it doesn't exist, create it.
                     /* Find the chat box and show it. If it doesn't exist, create it.
                      */
                      */
                     var chatbox = this.__super__.showChat.apply(this, arguments);
                     var chatbox = this.__super__.showChat.apply(this, arguments);
-                    if (chatbox.get('minimized')) {
+                    var maximize = _.isUndefined(attrs.maximize) ? true : attrs.maximize;
+                    if (chatbox.get('minimized') && maximize) {
                         chatbox.maximize();
                         chatbox.maximize();
                     }
                     }
                     return chatbox;
                     return chatbox;

+ 3 - 0
src/converse-muc.js

@@ -1830,6 +1830,9 @@
                         } else if (typeof attrs === "undefined") {
                         } else if (typeof attrs === "undefined") {
                             attrs = {};
                             attrs = {};
                         }
                         }
+                        if (_.isUndefined(attrs.maximize)) {
+                            attrs.maximize = false;
+                        }
                         var fetcher = converse.chatboxviews.showChat.bind(converse.chatboxviews);
                         var fetcher = converse.chatboxviews.showChat.bind(converse.chatboxviews);
                         if (!attrs.nick && converse.muc_nickname_from_jid) {
                         if (!attrs.nick && converse.muc_nickname_from_jid) {
                             attrs.nick = Strophe.getNodeFromJid(converse.bare_jid);
                             attrs.nick = Strophe.getNodeFromJid(converse.bare_jid);