GUACAMOLE-724: Ensure focus is not retained when transferring a client from an unattached group to an attached group.

This commit is contained in:
Michael Jumper
2021-06-21 21:04:31 -07:00
parent 19a32d3e10
commit 448ebb5019

View File

@@ -95,8 +95,20 @@ angular.module('client').factory('guacClientManager', ['$injector',
// Remove client from all groups
managedClientGroups.forEach(group => {
_.remove(group.clients, client => (client.id === id));
var removed = _.remove(group.clients, client => (client.id === id));
if (removed.length) {
// Reset focus state if client is being removed from a group
// that isn't currently attached (focus may otherwise be
// retained and result in a newly added connection unexpectedly
// sharing focus)
if (!group.attached)
removed.forEach(client => { client.clientProperties.focused = false; });
// Recalculate group grid if number of clients is changing
ManagedClientGroup.recalculateTiles(group);
}
});
// Remove any groups that are now empty