@@ -20,13 +20,13 @@ qx.Class.define("osparc.info.CommentAdd", {
2020 extend : qx . ui . core . Widget ,
2121
2222 /**
23- * @param studyId {String} Study Id
23+ * @param studyData {Object} serialized Study Data
2424 * @param conversationId {String} Conversation Id
2525 */
26- construct : function ( studyId , conversationId = null ) {
26+ construct : function ( studyData , conversationId = null ) {
2727 this . base ( arguments ) ;
2828
29- this . __studyId = studyId ;
29+ this . __studyData = studyData ;
3030 this . __conversationId = conversationId ;
3131
3232 this . _setLayout ( new qx . ui . layout . VBox ( 5 ) ) ;
@@ -39,7 +39,7 @@ qx.Class.define("osparc.info.CommentAdd", {
3939 } ,
4040
4141 members : {
42- __studyId : null ,
42+ __studyData : null ,
4343 __conversationId : null ,
4444
4545 _createChildControlImpl : function ( id ) {
@@ -134,8 +134,9 @@ qx.Class.define("osparc.info.CommentAdd", {
134134 __notifyUserTapped : function ( ) {
135135 const showOrganizations = false ;
136136 const showAccessRights = false ;
137- const recipientsManager = new osparc . share . NewCollaboratorsManager ( currentStudy , showOrganizations , showAccessRights ) ;
138- // OM: extend NewCollaboratorsManager to only allow one user selected
137+ const recipientsManager = new osparc . share . NewCollaboratorsManager ( this . __studyData , showOrganizations , showAccessRights ) . set ( {
138+ acceptOnlyOne : true ,
139+ } ) ;
139140 recipientsManager . setCaption ( this . tr ( "Notify user" ) ) ;
140141 recipientsManager . getActionButton ( ) . setLabel ( this . tr ( "Notify" ) ) ;
141142 recipientsManager . addListener ( "addCollaborators" , e => {
@@ -147,7 +148,7 @@ qx.Class.define("osparc.info.CommentAdd", {
147148 this . __postNotify ( userGid ) ;
148149 } else {
149150 // create new conversation first
150- osparc . study . Conversations . addConversation ( this . __studyId )
151+ osparc . study . Conversations . addConversation ( this . __studyData [ "uuid" ] )
151152 . then ( data => {
152153 this . __conversationId = data [ "conversationId" ] ;
153154 this . __postNotify ( userGid ) ;
@@ -162,7 +163,7 @@ qx.Class.define("osparc.info.CommentAdd", {
162163 this . __postMessage ( ) ;
163164 } else {
164165 // create new conversation first
165- osparc . study . Conversations . addConversation ( this . __studyId )
166+ osparc . study . Conversations . addConversation ( this . __studyData [ "uuid" ] )
166167 . then ( data => {
167168 this . __conversationId = data [ "conversationId" ] ;
168169 this . __postMessage ( ) ;
@@ -174,7 +175,7 @@ qx.Class.define("osparc.info.CommentAdd", {
174175 const commentField = this . getChildControl ( "comment-field" ) ;
175176 const comment = commentField . getChildControl ( "text-area" ) . getValue ( ) ;
176177 if ( comment ) {
177- osparc . study . Conversations . addMessage ( this . __studyId , this . __conversationId , comment )
178+ osparc . study . Conversations . addMessage ( this . __studyData [ "uuid" ] , this . __conversationId , comment )
178179 . then ( data => {
179180 this . fireDataEvent ( "commentAdded" , data ) ;
180181 commentField . getChildControl ( "text-area" ) . setValue ( "" ) ;
@@ -184,7 +185,7 @@ qx.Class.define("osparc.info.CommentAdd", {
184185
185186 __postNotify : function ( userGroupId = 10 ) {
186187 if ( userGroupId ) {
187- osparc . study . Conversations . notifyUser ( this . __studyId , this . __conversationId , userGroupId )
188+ osparc . study . Conversations . notifyUser ( this . __studyData [ "uuid" ] , this . __conversationId , userGroupId )
188189 . then ( data => {
189190 console . log ( data ) ;
190191 } ) ;
0 commit comments