Skip to content

Commit f0b4110

Browse files
committed
don't wait for socket
1 parent 84b2c49 commit f0b4110

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

services/static-webserver/client/source/class/osparc/conversation/AddMessage.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ qx.Class.define("osparc.conversation.AddMessage", {
3636
},
3737

3838
events: {
39-
"commentAdded": "qx.event.type.Data",
40-
"messageEdited": "qx.event.type.Data",
39+
"messageAdded": "qx.event.type.Data",
40+
"messageUpdated": "qx.event.type.Data",
4141
},
4242

4343
members: {
@@ -227,7 +227,7 @@ qx.Class.define("osparc.conversation.AddMessage", {
227227
if (content) {
228228
osparc.study.Conversations.addMessage(this.__studyData["uuid"], this.__conversationId, content)
229229
.then(data => {
230-
this.fireDataEvent("commentAdded", data);
230+
this.fireDataEvent("messageAdded", data);
231231
commentField.getChildControl("text-area").setValue("");
232232
});
233233
}
@@ -239,7 +239,7 @@ qx.Class.define("osparc.conversation.AddMessage", {
239239
if (content) {
240240
osparc.study.Conversations.editMessage(this.__studyData["uuid"], this.__conversationId, this.__message["messageId"], content)
241241
.then(data => {
242-
this.fireDataEvent("messageEdited", data);
242+
this.fireDataEvent("messageUpdated", data);
243243
commentField.getChildControl("text-area").setValue("");
244244
});
245245
}
@@ -249,7 +249,7 @@ qx.Class.define("osparc.conversation.AddMessage", {
249249
if (userGid) {
250250
osparc.study.Conversations.notifyUser(this.__studyData["uuid"], this.__conversationId, userGid)
251251
.then(data => {
252-
this.fireDataEvent("commentAdded", data);
252+
this.fireDataEvent("messageAdded", data);
253253
const potentialCollaborators = osparc.store.Groups.getInstance().getPotentialCollaborators();
254254
if (userGid in potentialCollaborators) {
255255
if ("getUserId" in potentialCollaborators[userGid]) {

services/static-webserver/client/source/class/osparc/conversation/Conversation.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ qx.Class.define("osparc.conversation.Conversation", {
167167
if (osparc.data.model.Study.canIWrite(this.__studyData["accessRights"])) {
168168
const addMessages = new osparc.conversation.AddMessage(this.__studyData, this.getConversationId());
169169
addMessages.setPaddingLeft(10);
170-
addMessages.addListener("commentAdded", e => {
170+
addMessages.addListener("messageAdded", e => {
171171
const data = e.getData();
172172
if (data["conversationId"]) {
173173
this.setConversationId(data["conversationId"]);
174+
this.addMessage(data);
174175
}
175176
});
176177
this._add(addMessages);
@@ -259,6 +260,8 @@ qx.Class.define("osparc.conversation.Conversation", {
259260
switch (message["type"]) {
260261
case "MESSAGE":
261262
control = new osparc.conversation.MessageUI(message, this.__studyData);
263+
control.addListener("messageUpdated", e => this.updateMessage(e.getData()));
264+
control.addListener("messageDeleted", e => this.deleteMessage(e.getData()));
262265
break;
263266
case "NOTIFICATION":
264267
control = new osparc.conversation.NotificationUI(message);

services/static-webserver/client/source/class/osparc/conversation/MessageUI.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ qx.Class.define("osparc.conversation.MessageUI", {
4545
},
4646

4747
events: {
48-
"messageEdited": "qx.event.type.Event",
49-
"messageDeleted": "qx.event.type.Event",
48+
"messageUpdated": "qx.event.type.Data",
49+
"messageDeleted": "qx.event.type.Data",
5050
},
5151

5252
properties: {
@@ -207,9 +207,9 @@ qx.Class.define("osparc.conversation.MessageUI", {
207207
resizable: true,
208208
showClose: true,
209209
});
210-
addMessage.addListener("messageEdited", () => {
210+
addMessage.addListener("messageUpdated", e => {
211211
win.close();
212-
this.fireDataEvent("messageEdited");
212+
this.fireDataEvent("messageUpdated", e.getData());
213213
});
214214
},
215215

@@ -225,7 +225,7 @@ qx.Class.define("osparc.conversation.MessageUI", {
225225
win.addListener("close", () => {
226226
if (win.getConfirmed()) {
227227
osparc.study.Conversations.deleteMessage(message)
228-
.then(() => this.fireEvent("messageDeleted"))
228+
.then(() => this.fireDataEvent("messageDeleted", message))
229229
.catch(err => osparc.FlashMessenger.logError(err));
230230
}
231231
});

0 commit comments

Comments
 (0)