pull/3162/merge
Ernesto Tejeda Poveda 2025-04-25 18:09:30 +02:00 committed by GitHub
commit 44470358ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -12,7 +12,9 @@ patch(ListController.prototype, {
// We expand layer by layer. So first we need to find the highest
// layer that's not already fully expanded.
let layer = this.model.root.groups;
let max_length = 0;
while (layer.length) {
max_length = Math.max(max_length, layer.length);
const closed = layer.filter(function (group) {
return group._config.isFolded;
});
@ -30,7 +32,13 @@ patch(ListController.prototype, {
})
);
}
// Save the default value of MAX_NUMBER_OPENED_GROUPS to restore it later
const default_max_opened = this.model.constructor.MAX_NUMBER_OPENED_GROUPS;
// Set in MAX_NUMBER_OPENED_GROUPS the maximum number of groups that can be opened
this.model.constructor.MAX_NUMBER_OPENED_GROUPS = max_length;
await this.model.root.load();
// Restore the default value of MAX_NUMBER_OPENED_GROUPS
this.model.constructor.MAX_NUMBER_OPENED_GROUPS = default_max_opened;
this.model.notify();
},
@ -38,7 +46,9 @@ patch(ListController.prototype, {
// We collapse layer by layer. So first we need to find the deepest
// layer that's not already fully collapsed.
let layer = this.model.root.groups;
let max_length = 0;
while (layer.length) {
max_length = Math.max(max_length, layer.length);
const next = flatten(
layer.map(function (group) {
return group.list.groups || [];
@ -55,7 +65,13 @@ patch(ListController.prototype, {
}
layer = next;
}
// Save the default value of MAX_NUMBER_OPENED_GROUPS to restore it later
const default_max_opened = this.model.constructor.MAX_NUMBER_OPENED_GROUPS;
// Set in MAX_NUMBER_OPENED_GROUPS the maximum number of groups that can be opened
this.model.constructor.MAX_NUMBER_OPENED_GROUPS = max_length;
await this.model.root.load();
// Restore the default value of MAX_NUMBER_OPENED_GROUPS
this.model.constructor.MAX_NUMBER_OPENED_GROUPS = default_max_opened;
this.model.notify();
},
});