Fix NO_SUCH_CHANNEL error after using the debug app

This commit is contained in:
yflory 2022-12-19 16:10:42 +01:00
parent 770fb3d657
commit 8245189bcb
2 changed files with 33 additions and 0 deletions

View File

@ -2439,6 +2439,27 @@ define([
// Clients management
var driveEventClients = [];
// Check if this is a channel that we shouldn't leave when closing the debug app
var alwaysOnline = function (chanId) {
if (!store) { return; }
// Drive
if (store.driveChannel === chanId) { return true; }
// Shared folders
if (SF.isSharedFolderChannel(chanId)) { return true; }
// Teams
if (Util.find(store, ['proxy', 'teams'])) {
var t = Util.find(store, ['proxy', 'teams']) || {};
return Object.keys(t).some(function (id) {
return t[id].channel === chanId;
});
}
// Profile
if (Util.find(store, ['proxy', 'profile', 'href'])) {
return Hash.hrefToHexChannelId(Util.find(store, ['proxy', 'profile', 'href']))
=== chanId;
}
};
var dropChannel = Store.dropChannel = function (chanId) {
console.error('Drop channel', chanId);
@ -2451,6 +2472,14 @@ define([
try {
store.onlyoffice.leavePad(chanId);
} catch (e) { console.error(e); }
try {
if (alwaysOnline(chanId)) {
delete Store.channels[chanId];
return;
}
} catch (e) { console.error(e); }
try {
Cache.leaveChannel(chanId);
} catch (e) { console.error(e); }

View File

@ -385,5 +385,9 @@ define([
});
};
SF.isSharedFolderChannel = function (chanId) {
return Object.keys(allSharedFolders).includes(chanId);
};
return SF;
});