This commit is contained in:
JC Brand 2022-02-20 19:17:25 +01:00
parent a468a0fb24
commit b248803a4b
3 changed files with 14 additions and 7 deletions

View File

@ -16,6 +16,7 @@
- #2788: `TypeError` when trying to use `@converse/headless` - #2788: `TypeError` when trying to use `@converse/headless`
- #2789: Implement new hook `parseMessageForCommands` for plugins to add custom commands - #2789: Implement new hook `parseMessageForCommands` for plugins to add custom commands
- #2814: Links are mangled on open/copy - #2814: Links are mangled on open/copy
- #2822: Singleton doesn't work in overlayed view mode
## 9.0.0 (2021-11-26) ## 9.0.0 (2021-11-26)

View File

@ -56,7 +56,9 @@ converse.plugins.add('converse-dragresize', {
Object.assign(_converse.ChatBoxView.prototype, DragResizableMixin); Object.assign(_converse.ChatBoxView.prototype, DragResizableMixin);
Object.assign(_converse.ChatRoomView.prototype, DragResizableMixin); Object.assign(_converse.ChatRoomView.prototype, DragResizableMixin);
Object.assign(_converse.ControlBoxView.prototype, DragResizableMixin); if (_converse.ControlBoxView) {
Object.assign(_converse.ControlBoxView.prototype, DragResizableMixin);
}
/************************ BEGIN Event Handlers ************************/ /************************ BEGIN Event Handlers ************************/
function registerGlobalEventHandlers () { function registerGlobalEventHandlers () {

View File

@ -15,20 +15,24 @@ converse.plugins.add('converse-singleton', {
}, },
initialize () { initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
api.settings.extend({ api.settings.extend({
'allow_logout': false, // No point in logging out when we have auto_login as true. 'allow_logout': false, // No point in logging out when we have auto_login as true.
'allow_muc_invitations': false, // Doesn't make sense to allow because only 'allow_muc_invitations': false, // Doesn't make sense to allow because only
// roster contacts can be invited // roster contacts can be invited
'hide_muc_server': true 'hide_muc_server': true
}); });
if (!Array.isArray(api.settings.get('auto_join_rooms')) &&
!Array.isArray(api.settings.get('auto_join_private_chats'))) { const auto_join_rooms = api.settings.get('auto_join_rooms');
const auto_join_private_chats = api.settings.get('auto_join_private_chats');
if (!Array.isArray(auto_join_rooms) && !Array.isArray(auto_join_private_chats)) {
throw new Error("converse-singleton: auto_join_rooms must be an Array"); throw new Error("converse-singleton: auto_join_rooms must be an Array");
} }
if (api.settings.get('auto_join_rooms').length > 1 || api.settings.get('auto_join_private_chats').length > 1) { if (auto_join_rooms.length === 0 && auto_join_private_chats.length === 0) {
throw new Error("If you set singleton set to true, you need "+
"to specify auto_join_rooms or auto_join_private_chats");
}
if (auto_join_rooms.length > 0 && auto_join_private_chats.length > 0) {
throw new Error("It doesn't make sense to have singleton set to true and " + throw new Error("It doesn't make sense to have singleton set to true and " +
"auto_join_rooms or auto_join_private_chats set to more then one, " + "auto_join_rooms or auto_join_private_chats set to more then one, " +
"since only one chat room may be open at any time."); "since only one chat room may be open at any time.");