@@ -143,24 +143,41 @@ qx.Class.define("osparc.support.Conversation", {
143143 __applyConversation : function ( conversation ) {
144144 this . __reloadMessages ( true ) ;
145145
146+ const shareProjectCB = this . getChildControl ( "share-project-checkbox" ) ;
147+ const shareProjectLayout = this . getChildControl ( "share-project-layout" ) ;
146148 const currentStudy = osparc . store . Store . getInstance ( ) . getCurrentStudy ( ) ;
147- if ( conversation === null && currentStudy ) {
148- this . getChildControl ( "share-project-checkbox" ) . show ( ) ;
149+ let showCB = false ;
150+ if ( currentStudy ) {
151+ if ( conversation ) {
152+ if ( conversation . getContextProjectId ( ) === currentStudy . getUuid ( ) ) {
153+ showCB = true ;
154+ }
155+ } else {
156+ showCB = true ;
157+ }
149158 }
150- /*
151- const shareProjectLayout = this.getChildControl("share-project-layout");
152- shareProjectLayout.setVisibility(conversation && currentStudy ? "visible" : "excluded");
153- if (conversation && currentStudy) {
154- const shareProjectCB = this.getChildControl("share-project-checkbox");
155- const supportGroupId = currentStudy.getSupportGroupId();
159+ shareProjectLayout . setVisibility ( showCB ? "visible" : "excluded" ) ;
160+
161+ if ( currentStudy && conversation && conversation . getContextProjectId ( ) === currentStudy . getUuid ( ) ) {
162+ let isAlreadyShared = false ;
156163 const accessRights = currentStudy . getAccessRights ( ) ;
164+ const supportGroupId = osparc . store . Products . getInstance ( ) . getSupportGroupId ( ) ;
157165 if ( supportGroupId && supportGroupId in accessRights ) {
158- shareProjectCB.setValue( true) ;
166+ isAlreadyShared = true ;
159167 } else {
160- shareProjectCB.setValue( false) ;
168+ isAlreadyShared = false ;
161169 }
170+ shareProjectCB . setValue ( isAlreadyShared ) ;
171+ }
172+
173+ shareProjectCB . removeListener ( "changeValue" , this . __shareProjectWithSupport , this ) ;
174+ if ( showCB ) {
175+ shareProjectCB . addListener ( "changeValue" , this . __shareProjectWithSupport , this ) ;
162176 }
163- */
177+ } ,
178+
179+ __shareProjectWithSupport : function ( e ) {
180+ console . log ( "Share project with support: " , e . getData ( ) ) ;
164181 } ,
165182
166183 __reloadMessages : function ( removeMessages = true ) {
0 commit comments