Add and document bring_to_foreground
option to rooms API
This commit is contained in:
parent
3c7454c4c1
commit
fbc81d30ec
@ -987,6 +987,9 @@ Room attributes that may be passed in:
|
|||||||
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
|
* *maximize*: A boolean, indicating whether minimized rooms should also be
|
||||||
maximized, when opened. Set to ``false`` by default.
|
maximized, when opened. Set to ``false`` by default.
|
||||||
|
* *bring_to_foreground*: A boolean indicating whether the room should be
|
||||||
|
brought to the foreground and therefore replace the currently shown chat.
|
||||||
|
If there is no chat currently open, then this option is ineffective.
|
||||||
|
|
||||||
For example, opening a room with a specific default configuration:
|
For example, opening a room with a specific default configuration:
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@
|
|||||||
*/
|
*/
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const jid = ev.target.getAttribute('data-room-jid');
|
const jid = ev.target.getAttribute('data-room-jid');
|
||||||
const chatroom = _converse.openChatRoom({'jid': jid}, true);
|
const chatroom = _converse.api.rooms.open(jid, {'bring_to_foreground': true});
|
||||||
_converse.chatboxviews.get(jid).renderBookmarkForm();
|
_converse.chatboxviews.get(jid).renderBookmarkForm();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2895,13 +2895,16 @@
|
|||||||
|
|
||||||
_converse.getChatRoom = function (jid, attrs, fetcher) {
|
_converse.getChatRoom = function (jid, attrs, fetcher) {
|
||||||
jid = jid.toLowerCase();
|
jid = jid.toLowerCase();
|
||||||
return _converse.getViewForChatBox(fetcher(_.extend({
|
return _converse.getViewForChatBox(
|
||||||
|
fetcher(_.extend({
|
||||||
'id': jid,
|
'id': jid,
|
||||||
'jid': jid,
|
'jid': jid,
|
||||||
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
||||||
'type': CHATROOMS_TYPE,
|
'type': CHATROOMS_TYPE,
|
||||||
'box_id': b64_sha1(jid)
|
'box_id': b64_sha1(jid)
|
||||||
}, attrs)));
|
}, attrs),
|
||||||
|
attrs.bring_to_foreground
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
/* We extend the default converse.js API to add methods specific to MUC
|
/* We extend the default converse.js API to add methods specific to MUC
|
||||||
|
Loading…
Reference in New Issue
Block a user