Skip to content

Commit fd785f7

Browse files
committed
lastMessages
1 parent 17a93be commit fd785f7

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

services/static-webserver/client/source/class/osparc/store/ConversationsSupport.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ qx.Class.define("osparc.store.ConversationsSupport", {
9797
.catch(err => osparc.FlashMessenger.logError(err));
9898
},
9999

100+
getLastMessage: function(conversationId) {
101+
const params = {
102+
url: {
103+
conversationId,
104+
offset: 0,
105+
limit: 1,
106+
}
107+
};
108+
return osparc.data.Resources.fetch("conversationsSupport", "getMessagesPage", params);
109+
},
110+
100111
addMessage: function(conversationId, message) {
101112
const params = {
102113
url: {

services/static-webserver/client/source/class/osparc/support/ConversationListItem.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,15 @@ qx.Class.define("osparc.support.ConversationListItem", {
159159
},
160160

161161
__applyConversationId: function(conversationId) {
162-
osparc.store.ConversationsSupport.getInstance().getConversation(conversationId)
163-
.then(conversation => {
164-
this.set({
165-
title: conversation.title,
166-
author: conversation.author,
167-
lastModified: conversation.lastModified,
168-
});
162+
osparc.store.ConversationsSupport.getInstance().getLastMessage(conversationId)
163+
.then(lastMessages => {
164+
if (lastMessages && lastMessages.length) {
165+
this.set({
166+
title: lastMessages[0].title,
167+
author: lastMessages[0].author,
168+
lastModified: lastMessages[0].lastModified,
169+
});
170+
}
169171
});
170172
},
171173
}

0 commit comments

Comments
 (0)