@@ -30,7 +30,7 @@ qx.Class.define("osparc.study.Conversation", {
3030 this . __messages = [ ] ;
3131
3232 if ( conversationData ) {
33- const conversation = new osparc . data . model . Conversation ( conversationData ) ;
33+ const conversation = new osparc . data . model . Conversation ( conversationData , this . __studyData ) ;
3434 this . setConversation ( conversation ) ;
3535 this . setLabel ( conversationData [ "name" ] ) ;
3636 } else {
@@ -120,7 +120,7 @@ qx.Class.define("osparc.study.Conversation", {
120120 // create new conversation first
121121 osparc . store . ConversationsProject . getInstance ( ) . postConversation ( this . __studyData [ "uuid" ] , newLabel )
122122 . then ( data => {
123- const conversation = new osparc . data . model . Conversation ( data ) ;
123+ const conversation = new osparc . data . model . Conversation ( data , this . __studyData ) ;
124124 this . setConversation ( conversation ) ;
125125 this . getChildControl ( "button" ) . setLabel ( newLabel ) ;
126126 } ) ;
@@ -209,7 +209,7 @@ qx.Class.define("osparc.study.Conversation", {
209209 // create new conversation first
210210 osparc . store . ConversationsProject . getInstance ( ) . postConversation ( this . __studyData [ "uuid" ] )
211211 . then ( data => {
212- const newConversation = new osparc . data . model . Conversation ( data ) ;
212+ const newConversation = new osparc . data . model . Conversation ( data , this . __studyData ) ;
213213 this . setConversation ( newConversation ) ;
214214 this . __postMessage ( content ) ;
215215 } ) ;
@@ -224,7 +224,7 @@ qx.Class.define("osparc.study.Conversation", {
224224 // create new conversation first
225225 osparc . store . ConversationsProject . getInstance ( ) . postConversation ( this . __studyData [ "uuid" ] )
226226 . then ( data => {
227- const newConversation = new osparc . data . model . Conversation ( data ) ;
227+ const newConversation = new osparc . data . model . Conversation ( data , this . __studyData ) ;
228228 this . setConversation ( newConversation ) ;
229229 this . __postNotify ( userGid ) ;
230230 } ) ;
@@ -255,27 +255,6 @@ qx.Class.define("osparc.study.Conversation", {
255255 } ) ;
256256 } ,
257257
258- __getNextRequest : function ( ) {
259- const params = {
260- url : {
261- studyId : this . __studyData [ "uuid" ] ,
262- conversationId : this . getConversationId ( ) ,
263- offset : 0 ,
264- limit : 42
265- }
266- } ;
267- const nextRequestParams = this . __nextRequestParams ;
268- if ( nextRequestParams ) {
269- params . url . offset = nextRequestParams . offset ;
270- params . url . limit = nextRequestParams . limit ;
271- }
272- const options = {
273- resolveWResponse : true
274- } ;
275- return osparc . data . Resources . fetch ( "conversationsStudies" , "getMessagesPage" , params , options )
276- . catch ( err => osparc . FlashMessenger . logError ( err ) ) ;
277- } ,
278-
279258 __reloadMessages : function ( removeMessages = true ) {
280259 if ( this . getConversationId ( ) === null ) {
281260 // temporary conversation page
@@ -285,16 +264,15 @@ qx.Class.define("osparc.study.Conversation", {
285264 return ;
286265 }
287266
288- this . __messagesList . show ( ) ;
289- this . __loadMoreMessages . show ( ) ;
290- this . __loadMoreMessages . setFetching ( true ) ;
291-
292267 if ( removeMessages ) {
293268 this . __messages = [ ] ;
294269 this . __messagesList . removeAll ( ) ;
295270 }
271+ this . __messagesList . show ( ) ;
296272
297- this . __getNextRequest ( )
273+ this . __loadMoreMessages . show ( ) ;
274+ this . __loadMoreMessages . setFetching ( true ) ;
275+ this . getConversation ( ) . getNextMessages ( )
298276 . then ( resp => {
299277 const messages = resp [ "data" ] ;
300278 messages . forEach ( message => this . addMessage ( message ) ) ;
@@ -403,7 +381,8 @@ qx.Class.define("osparc.study.Conversation", {
403381 // Update the UI element from the messages list
404382 this . __messagesList . getChildren ( ) . forEach ( control => {
405383 if ( "getMessage" in control && control . getMessage ( ) [ "messageId" ] === message [ "messageId" ] ) {
406- control . setMessage ( message ) ;
384+ // Force a new reference
385+ control . setMessage ( Object . assign ( { } , message ) ) ;
407386 return ;
408387 }
409388 } ) ;
0 commit comments