Skip to content

Commit 154b492

Browse files
committed
amIOwner
1 parent 54bc617 commit 154b492

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ qx.Class.define("osparc.data.model.Conversation", {
159159
return promise;
160160
},
161161

162+
amIOwner: function() {
163+
return this.getUserGroupId() === osparc.auth.Data.getInstance().getGroupId();
164+
},
165+
162166
getNextMessages: function() {
163167
const params = {
164168
url: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ qx.Class.define("osparc.support.Conversation", {
152152
// initiating conversation
153153
showCB = true;
154154
}
155-
if (conversation && conversation.getContextProjectId()) {
155+
if (conversation && conversation.getContextProjectId() && conversation.amIOwner()) {
156156
// it was already set
157157
showCB = true;
158158
}

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,33 @@ qx.Class.define("osparc.support.ConversationPage", {
129129

130130
__applyConversation: function(conversation) {
131131
const title = this.getChildControl("conversation-title");
132-
const extraContextLabel = this.getChildControl("conversation-extra-content");
133-
const options = this.getChildControl("conversation-options");
134132
if (conversation) {
135133
conversation.bind("nameAlias", title, "value");
136-
const amISupporter = osparc.store.Products.getInstance().amIASupportUser();
134+
} else {
135+
title.setValue(this.tr("Ask a Question"));
136+
}
137+
138+
const extraContextLabel = this.getChildControl("conversation-extra-content");
139+
const amISupporter = osparc.store.Products.getInstance().amIASupportUser();
140+
if (conversation && amISupporter) {
137141
const extraContext = conversation.getExtraContext();
138-
if (amISupporter && extraContext && Object.keys(extraContext).length) {
142+
if (extraContext && Object.keys(extraContext).length) {
139143
let extraContextText = `Support ID: ${conversation.getConversationId()}`;
140144
const contextProjectId = conversation.getContextProjectId();
141145
if (contextProjectId) {
142146
extraContextText += `<br>Project ID: ${contextProjectId}`;
143147
}
144148
extraContextLabel.setValue(extraContextText);
145149
}
146-
extraContextLabel.setVisibility(amISupporter ? "visible" : "excluded");
150+
extraContextLabel.show();
151+
} else {
152+
extraContextLabel.exclude();
153+
}
154+
155+
const options = this.getChildControl("conversation-options");
156+
if (conversation && conversation.amIOwner()) {
147157
options.show();
148158
} else {
149-
title.setValue("");
150159
options.exclude();
151160
}
152161
},

0 commit comments

Comments
 (0)