@@ -101,7 +101,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
101101 if ( osparc . auth . core . Utils . checkEmail ( email ) ) {
102102 this . __selectedCollaborators [ email ] = email ;
103103 const invitedButton = this . __invitedButton ( email ) ;
104- this . getChildControl ( "potential-collaborators-list" ) . add ( invitedButton ) ;
104+ this . getChildControl ( "potential-collaborators-list" ) . addAt ( invitedButton , 0 ) ;
105105 invitedButton . setValue ( true ) ;
106106 }
107107 } ) ;
@@ -280,6 +280,10 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
280280 } ,
281281
282282 __invitedButton : function ( email ) {
283+ if ( email in this . __selectedCollaborators ) {
284+ return this . __selectedCollaborators [ email ] ;
285+ }
286+
283287 const collaboratorData = {
284288 label : email ,
285289 description : null ,
@@ -291,7 +295,10 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
291295
292296 collaboratorButton . addListener ( "changeValue" , e => {
293297 const selected = e . getData ( ) ;
294- if ( ! selected && collaborator . email in this . __selectedCollaborators ) {
298+ if ( selected ) {
299+ this . __selectedCollaborators [ collaborator . email ] = collaborator ;
300+ collaboratorButton . unsubscribeToFilterGroup ( "collaboratorsManager" ) ;
301+ } else if ( collaborator . email in this . __selectedCollaborators ) {
295302 delete this . __selectedCollaborators [ collaborator . email ] ;
296303 collaboratorButton . subscribeToFilterGroup ( "collaboratorsManager" ) ;
297304 }
0 commit comments