Skip to content

Commit 4e52612

Browse files
committed
conversationCreated
1 parent 7e471f5 commit 4e52612

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ qx.Class.define("osparc.store.ConversationsSupport", {
2626
},
2727

2828
events: {
29+
"conversationCreated": "qx.event.type.Data",
2930
"conversationDeleted": "qx.event.type.Data",
3031
},
3132

@@ -90,6 +91,11 @@ qx.Class.define("osparc.store.ConversationsSupport", {
9091
}
9192
};
9293
return osparc.data.Resources.fetch("conversationsSupport", "postConversation", params)
94+
.then(conversationData => {
95+
const conversation = new osparc.data.model.Conversation(conversationData);
96+
this.__addToCache(conversation);
97+
this.fireDataEvent("conversationCreated", conversation);
98+
})
9399
.catch(err => osparc.FlashMessenger.logError(err));
94100
},
95101

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ qx.Class.define("osparc.support.Conversations", {
2727
this.__conversationListItems = [];
2828

2929
this.__fetchConversations();
30+
31+
this.__listenToNewConversations();
3032
},
3133

3234
statics: {
@@ -89,6 +91,13 @@ qx.Class.define("osparc.support.Conversations", {
8991
});
9092
},
9193

94+
__listenToNewConversations: function() {
95+
osparc.store.ConversationsSupport.getInstance().addListener("conversationCreated", e => {
96+
const conversation = e.getData();
97+
this.__addConversation(conversation);
98+
});
99+
},
100+
92101
__addConversation: function(conversation) {
93102
// ignore it if it was already there
94103
const conversationId = conversation.getConversationId();

0 commit comments

Comments
 (0)