Commit d4d03925 authored by JC Brand's avatar JC Brand

Set `hidden` to `true` by default for chats in singleton mode.

However, when a new chat is created due to an incoming message, and
there aren't any other chats visible, then show it.
parent 37b62225
......@@ -62326,13 +62326,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
comparator: 'time'
});
_converse.ChatBox = _converse.ModelWithVCardAndPresence.extend({
defaults: {
defaults() {
return {
'bookmarked': false,
'chat_state': undefined,
'num_unread': 0,
'type': 'chatbox',
'message_type': 'chat',
'url': ''
'url': '',
'hidden': _.includes(['mobile', 'fullscreen'], _converse.view_mode)
};
},
initialize() {
......@@ -76610,8 +76613,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// new functions which don't exist yet can also be added.
ChatBoxes: {
chatBoxMayBeShown(chatbox) {
if (_.includes(['mobile', 'fullscreen', 'embedded'], this.__super__._converse.view_mode)) {
const _converse = this.__super__._converse;
if (chatbox.get('id') === 'controlbox') {
return true;
}
if (_.includes(['mobile', 'fullscreen', 'embedded'], _converse.view_mode)) {
const any_chats_visible = _converse.chatboxes.filter(cb => cb.get('id') != 'controlbox').filter(cb => !cb.get('hidden')).length > 0;
if (any_chats_visible) {
return !chatbox.get('hidden');
} else {
return true;
}
} else {
return this.__super__.chatBoxMayBeShown.apply(this, arguments);
}
......@@ -245,13 +245,16 @@
_converse.ChatBox = _converse.ModelWithVCardAndPresence.extend({
defaults: {
defaults () {
return {
'bookmarked': false,
'chat_state': undefined,
'num_unread': 0,
'type': 'chatbox',
'message_type': 'chat',
'url': ''
'url': '',
'hidden': _.includes(['mobile', 'fullscreen'], _converse.view_mode)
}
},
initialize () {
......
......@@ -46,8 +46,20 @@
ChatBoxes: {
chatBoxMayBeShown (chatbox) {
if (_.includes(['mobile', 'fullscreen', 'embedded'], this.__super__._converse.view_mode)) {
const { _converse } = this.__super__;
if (chatbox.get('id') === 'controlbox') {
return true;
}
if (_.includes(['mobile', 'fullscreen', 'embedded'], _converse.view_mode)) {
const any_chats_visible = _converse.chatboxes
.filter((cb) => cb.get('id') != 'controlbox')
.filter((cb) => !cb.get('hidden')).length > 0;
if (any_chats_visible) {
return !chatbox.get('hidden');
} else {
return true;
}
} else {
return this.__super__.chatBoxMayBeShown.apply(this, arguments);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment