@@ -29,141 +29,39 @@ qx.Class.define("osparc.support.ConversationListItem", {
2929
3030 properties : {
3131 conversationId : {
32- check : "Number " ,
32+ check : "String " ,
3333 init : null ,
3434 nullable : false ,
3535 event : "changeConversationId" ,
3636 apply : "__applyConversationId" ,
3737 } ,
38-
39- /*
40- thumbnail: {
41- check: "String",
42- init: null,
43- nullable: false,
44- event: "changeThumbnail",
45- },
46-
47- title: {
48- check: "String",
49- init: null,
50- nullable: false,
51- event: "changeTitle",
52- },
53-
54- author: {
55- check: "String",
56- init: null,
57- nullable: false,
58- event: "changeAuthor",
59- },
60-
61- lastModified: {
62- check: "Date",
63- init: null,
64- nullable: false,
65- event: "changeLastModified",
66- },
67- */
68- } ,
69-
70- statics : {
71- GRID_POS : {
72- THUMBNAIL : {
73- row : 0 ,
74- column : 0 ,
75- rowSpan : 2 ,
76- } ,
77- TITLE : {
78- row : 0 ,
79- column : 1 ,
80- colSpan : 2 ,
81- } ,
82- AUTHOR : {
83- row : 1 ,
84- column : 1 ,
85- } ,
86- LAST_MODIFIED : {
87- row : 1 ,
88- column : 2 ,
89- } ,
90- BUTTON : {
91- row : 0 ,
92- column : 3 ,
93- rowSpan : 2
94- } ,
95- }
9638 } ,
9739
9840 members : {
99- /*
100- _createChildControlImpl: function(id) {
101- let control;
102- switch (id) {
103- case "thumbnail":
104- control = new qx.ui.basic.Image().set({
105- alignY: "middle",
106- scale: true,
107- allowGrowX: true,
108- allowGrowY: true,
109- allowShrinkX: true,
110- allowShrinkY: true,
111- maxWidth: 32,
112- maxHeight: 32
113- });
114- this._add(control, this.self().GRID_POS.THUMBNAIL);
115- break;
116- case "title":
117- control = new qx.ui.basic.Label().set({
118- font: "text-14",
119- alignY: "middle",
120- });
121- this._add(control, this.self().GRID_POS.TITLE);
122- break;
123- case "author":
124- control = new qx.ui.basic.Label().set({
125- font: "text-13"
126- });
127- this._add(control, this.self().GRID_POS.AUTHOR);
128- break;
129- case "author":
130- control = new qx.ui.basic.Label().set({
131- font: "text-13"
132- });
133- this._add(control, this.self().GRID_POS.LAST_MODIFIED);
134- break;
135- case "enter-button":
136- control = new qx.ui.form.Button().set({
137- icon: "@FontAwesome 5Solid/info/14"
138- });
139- this._add(control, this.self().GRID_POS.BUTTON);
140- break;
141- }
142-
143- return control || this.base(arguments, id);
144- },
145- */
146-
14741 __applyConversationId : function ( conversationId ) {
148- Promise . all ( [
149- osparc . store . ConversationsSupport . getInstance ( ) . getConversation ( conversationId ) ,
150- osparc . store . ConversationsSupport . getInstance ( ) . getLastMessage ( conversationId )
151- ] )
152- . then ( ( [ conversation , lastMessages ] ) => {
153- if ( conversation ) {
154- this . set ( {
155- thumbnail : conversation . thumbnail ,
156- title : conversation . title ,
157- author : conversation . author ,
158- lastModified : conversation . lastModified ,
159- } ) ;
160- }
161- if ( lastMessages && lastMessages . length ) {
42+ osparc . store . ConversationsSupport . getInstance ( ) . getLastMessage ( conversationId )
43+ . then ( lastMessages => {
44+ if ( lastMessages && lastMessages . length ) {
45+ this . getChildControl ( "thumbnail" ) . set ( {
46+ decorator : "rounded" ,
47+ } ) ;
48+ const lastMessage = lastMessages [ 0 ] ;
49+ const date = osparc . utils . Utils . formatDateAndTime ( new Date ( lastMessage . created ) ) ;
16250 this . set ( {
163- title : lastMessages [ 0 ] . title ,
164- author : lastMessages [ 0 ] . author ,
165- lastModified : lastMessages [ 0 ] . lastModified ,
51+ title : lastMessage . content ,
52+ subtitle : date ,
16653 } ) ;
54+
55+ const userGroupId = lastMessage . userGroupId ;
56+ osparc . store . Users . getInstance ( ) . getUser ( userGroupId )
57+ . then ( user => {
58+ if ( user ) {
59+ this . set ( {
60+ thumbnail : user . getThumbnail ( ) ,
61+ subtitle : user . getLabel ( ) + " - " + date ,
62+ } ) ;
63+ }
64+ } ) ;
16765 }
16866 } ) ;
16967 } ,
0 commit comments