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

This commit is contained in:
JC Brand 2016-11-30 11:00:12 +01:00
parent 96d311e2e9
commit 9edc97101b
4 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,7 @@
initialization is complete. [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]
- 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)
- #203 New configuration setting [muc_domain](https://conversejs.org/docs/html/configuration.html#muc_domain) [jcbrand]

View File

@ -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
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.
* *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:

View File

@ -196,7 +196,8 @@
/* Find the chat box and show it. If it doesn't exist, create it.
*/
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();
}
return chatbox;

View File

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