Skip to content

Commit 8bb9689

Browse files
committed
shareProjectCB
1 parent a5c5c09 commit 8bb9689

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ qx.Class.define("osparc.store.ConversationsSupport", {
149149
this.__addMessageToCache(conversationId, lastMessage);
150150
return lastMessage;
151151
}
152-
return lastMessage;
152+
return null;
153153
});
154154
},
155155

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

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,41 @@ qx.Class.define("osparc.support.Conversation", {
143143
__applyConversation: function(conversation) {
144144
this.__reloadMessages(true);
145145

146+
const shareProjectCB = this.getChildControl("share-project-checkbox");
147+
const shareProjectLayout = this.getChildControl("share-project-layout");
146148
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy();
147-
if (conversation === null && currentStudy) {
148-
this.getChildControl("share-project-checkbox").show();
149+
let showCB = false;
150+
if (currentStudy) {
151+
if (conversation) {
152+
if (conversation.getContextProjectId() === currentStudy.getUuid()) {
153+
showCB = true;
154+
}
155+
} else {
156+
showCB = true;
157+
}
149158
}
150-
/*
151-
const shareProjectLayout = this.getChildControl("share-project-layout");
152-
shareProjectLayout.setVisibility(conversation && currentStudy ? "visible" : "excluded");
153-
if (conversation && currentStudy) {
154-
const shareProjectCB = this.getChildControl("share-project-checkbox");
155-
const supportGroupId = currentStudy.getSupportGroupId();
159+
shareProjectLayout.setVisibility(showCB ? "visible" : "excluded");
160+
161+
if (currentStudy && conversation && conversation.getContextProjectId() === currentStudy.getUuid()) {
162+
let isAlreadyShared = false;
156163
const accessRights = currentStudy.getAccessRights();
164+
const supportGroupId = osparc.store.Products.getInstance().getSupportGroupId();
157165
if (supportGroupId && supportGroupId in accessRights) {
158-
shareProjectCB.setValue(true);
166+
isAlreadyShared = true;
159167
} else {
160-
shareProjectCB.setValue(false);
168+
isAlreadyShared = false;
161169
}
170+
shareProjectCB.setValue(isAlreadyShared);
171+
}
172+
173+
shareProjectCB.removeListener("changeValue", this.__shareProjectWithSupport, this);
174+
if (showCB) {
175+
shareProjectCB.addListener("changeValue", this.__shareProjectWithSupport, this);
162176
}
163-
*/
177+
},
178+
179+
__shareProjectWithSupport: function(e) {
180+
console.log("Share project with support: ", e.getData());
164181
},
165182

166183
__reloadMessages: function(removeMessages = true) {

0 commit comments

Comments
 (0)