Skip to content

Commit 13901c2

Browse files
committed
rename
1 parent 08da06c commit 13901c2

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

services/static-webserver/client/source/class/osparc/study/Conversations.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ qx.Class.define("osparc.study.Conversations", {
5252
PROJECT_ANNOTATION: "PROJECT_ANNOTATION",
5353
},
5454

55+
56+
CHANNELS: {
57+
CONVERSATION_CREATED: "conversation:created",
58+
CONVERSATION_UPDATED: "conversation:updated",
59+
CONVERSATION_DELETED: "conversation:deleted",
60+
CONVERSATION_MESSAGE_CREATED: "conversation:message:created",
61+
CONVERSATION_MESSAGE_UPDATED: "conversation:message:updated",
62+
CONVERSATION_MESSAGE_DELETED: "conversation:message:deleted",
63+
},
64+
5565
popUpInWindow: function(studyData, openConversationId = null) {
5666
const conversations = new osparc.study.Conversations(studyData, openConversationId);
5767
const title = qx.locale.Manager.tr("Conversations");
@@ -95,20 +105,20 @@ qx.Class.define("osparc.study.Conversations", {
95105
const socket = osparc.wrapper.WebSocket.getInstance();
96106

97107
[
98-
"conversation:created",
99-
"conversation:updated",
100-
"conversation:deleted",
108+
this.self().CHANNELS.CONVERSATION_CREATED,
109+
this.self().CHANNELS.CONVERSATION_UPDATED,
110+
this.self().CHANNELS.CONVERSATION_DELETED,
101111
].forEach(eventName => {
102112
const eventHandler = conversation => {
103113
if (conversation) {
104114
switch (eventName) {
105-
case "conversation:created":
115+
case this.self().CHANNELS.CONVERSATION_CREATED:
106116
this.__addConversationPage(conversation);
107117
break;
108-
case "conversation:updated":
118+
case this.self().CHANNELS.CONVERSATION_UPDATED:
109119
this.__updateConversationName(conversation);
110120
break;
111-
case "conversation:deleted":
121+
case this.self().CHANNELS.CONVERSATION_DELETED:
112122
this.__removeConversationPage(conversation["conversationId"]);
113123
break;
114124
}
@@ -119,23 +129,23 @@ qx.Class.define("osparc.study.Conversations", {
119129
});
120130

121131
[
122-
"conversation:message:created",
123-
"conversation:message:updated",
124-
"conversation:message:deleted",
132+
this.self().CHANNELS.CONVERSATION_MESSAGE_CREATED,
133+
this.self().CHANNELS.CONVERSATION_MESSAGE_UPDATED,
134+
this.self().CHANNELS.CONVERSATION_MESSAGE_DELETED,
125135
].forEach(eventName => {
126136
const eventHandler = message => {
127137
if (message) {
128138
const conversationId = message["conversationId"];
129139
const conversationPage = this.__getConversationPage(conversationId);
130140
if (conversationPage) {
131141
switch (eventName) {
132-
case "conversation:message:created":
142+
case this.self().CHANNELS.CONVERSATION_MESSAGE_CREATED:
133143
conversationPage.addMessage(message);
134144
break;
135-
case "conversation:message:updated":
145+
case this.self().CHANNELS.CONVERSATION_MESSAGE_UPDATED:
136146
conversationPage.updateMessage(message);
137147
break;
138-
case "conversation:message:deleted":
148+
case this.self().CHANNELS.CONVERSATION_MESSAGE_DELETED:
139149
conversationPage.deleteMessage(message);
140150
break;
141151
}

0 commit comments

Comments
 (0)