Skip to content

Commit 5ba40d0

Browse files
committed
extraContext
1 parent 204c384 commit 5ba40d0

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,24 @@ qx.Class.define("osparc.conversation.AddMessage", {
170170
this.__postMessage();
171171
} else {
172172
const studyData = this.getStudyData();
173+
let promise = null;
173174
if (studyData) {
174-
// create new conversation first
175-
osparc.store.ConversationsProject.getInstance().addConversation(studyData)
176-
.then(data => {
177-
this.setConversationId(data["conversationId"]);
178-
this.__postMessage();
179-
});
175+
// create new project conversation first
176+
promise = osparc.store.ConversationsProject.getInstance().addConversation(studyData)
180177
} else {
181178
// support conversation
179+
const extraContext = {};
180+
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy()
181+
if (currentStudy) {
182+
extraContext["projectId"] = currentStudy.getUuid();
183+
}
184+
promise = osparc.store.ConversationsSupport.getInstance().addConversation(extraContext);
182185
}
186+
promise
187+
.then(data => {
188+
this.setConversationId(data["conversationId"]);
189+
this.__postMessage();
190+
});
183191
}
184192
},
185193

@@ -191,7 +199,7 @@ qx.Class.define("osparc.conversation.AddMessage", {
191199
const studyData = this.getStudyData();
192200
const conversationId = this.getConversationId();
193201
if (studyData) {
194-
promise = osparc.store.ConversationsProject.getInstance().addMessage(studyData["uuid"], conversationId, content);;
202+
promise = osparc.store.ConversationsProject.getInstance().addMessage(studyData["uuid"], conversationId, content);
195203
} else {
196204
promise = osparc.store.ConversationsSupport.getInstance().addMessage(conversationId, content);
197205
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ qx.Class.define("osparc.store.ConversationsSupport", {
5858
return osparc.data.Resources.fetch("conversationsSupport", "getConversation", params);
5959
},
6060

61-
addConversation: function(name = "null", type = osparc.store.ConversationsSupport.TYPES.SUPPORT) {
61+
addConversation: function(extraContext = {}) {
62+
extraContext["deployment"] = window.location.href;
6263
const params = {
6364
data: {
64-
name,
65-
type,
65+
name: "null",
66+
type: osparc.store.ConversationsSupport.TYPES.SUPPORT,
67+
extraContext,
6668
}
6769
};
6870
return osparc.data.Resources.fetch("conversationsSupport", "addConversation", params)

0 commit comments

Comments
 (0)