Skip to content

Commit 6596dd7

Browse files
committed
renameConversation
1 parent f8a9ad0 commit 6596dd7

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,8 +1490,8 @@ qx.Class.define("osparc.data.Resources", {
14901490
url: statics.API + "/conversations/{conversationId}?type=SUPPORT"
14911491
},
14921492
renameConversation: {
1493-
method: "PUT",
1494-
url: statics.API + "/conversations/{conversationId}"
1493+
method: "PATCH",
1494+
url: statics.API + "/conversations/{conversationId}?type=SUPPORT"
14951495
},
14961496
deleteConversation: {
14971497
method: "DELETE",

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

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

162+
renameConversation: function(newName) {
163+
osparc.store.ConversationsSupport.getInstance().renameConversation(this.getConversationId(), newName)
164+
.then(() => {
165+
this.setNameAlias(newName);
166+
});
167+
},
168+
162169
addMessage: function(message) {
163170
const messages = this.getMessages() || [];
164171
messages.push(message);

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

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

2828
events: {
29-
"conversationRenamed": "qx.event.type.Data",
3029
"conversationDeleted": "qx.event.type.Data",
3130
},
3231

@@ -118,14 +117,7 @@ qx.Class.define("osparc.store.ConversationsSupport", {
118117
name,
119118
}
120119
};
121-
return osparc.data.Resources.fetch("conversationsSupport", "renameConversation", params)
122-
.then(() => {
123-
this.fireDataEvent("conversationRenamed", {
124-
conversationId,
125-
name,
126-
});
127-
})
128-
.catch(err => osparc.FlashMessenger.logError(err));
120+
return osparc.data.Resources.fetch("conversationsSupport", "renameConversation", params);
129121
},
130122

131123
getLastMessage: function(conversationId) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ qx.Class.define("osparc.support.ConversationPage", {
160160
renamer.addListener("labelChanged", e => {
161161
renamer.close();
162162
const newLabel = e.getData()["newLabel"];
163-
this.getConversation().setName(newLabel);
163+
this.getConversation().renameConversation(newLabel);
164164
}, this);
165165
renamer.center();
166166
renamer.open();

0 commit comments

Comments
 (0)