Skip to content
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ed7d89c
first commit
matusdrobuliak66 Oct 8, 2025
dbf8198
refactor: base class
odeimaiz Oct 9, 2025
4fe35f4
minor
odeimaiz Oct 9, 2025
1e501b4
refactor
odeimaiz Oct 9, 2025
1236290
new props
odeimaiz Oct 9, 2025
7523a4d
minor
odeimaiz Oct 9, 2025
21d82a4
badges
odeimaiz Oct 9, 2025
5ce43d1
filter buttons
odeimaiz Oct 9, 2025
74935ab
aesthetics
odeimaiz Oct 9, 2025
77c334e
__sortConversations
odeimaiz Oct 9, 2025
33d07a5
setModified after adding message
odeimaiz Oct 9, 2025
9d120e8
modified on ListItem
odeimaiz Oct 9, 2025
2acd37d
markAsRead
odeimaiz Oct 9, 2025
e4cf401
markAsRead
odeimaiz Oct 9, 2025
a0d3285
currentFilter working
odeimaiz Oct 9, 2025
a0323ff
markAsResolved
odeimaiz Oct 9, 2025
ca59240
markAsResolved
odeimaiz Oct 9, 2025
55cce47
minor
odeimaiz Oct 9, 2025
26cbaa2
Update services/static-webserver/client/source/class/osparc/support/C…
odeimaiz Oct 9, 2025
9114e74
help-button
odeimaiz Oct 10, 2025
bc74459
SupportButton
odeimaiz Oct 10, 2025
f2bd796
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 10, 2025
3923df5
minor
odeimaiz Oct 10, 2025
1a8900f
aesthetics
odeimaiz Oct 10, 2025
30b4ce7
readBySupport
odeimaiz Oct 10, 2025
5010787
dot on icon
odeimaiz Oct 10, 2025
231c87d
unreadMessages property
odeimaiz Oct 10, 2025
0e75707
more binding
odeimaiz Oct 10, 2025
df3eaa0
working filter
odeimaiz Oct 10, 2025
e875d3b
refactor
odeimaiz Oct 10, 2025
0f4bbae
cache conversations
odeimaiz Oct 10, 2025
a082251
cleanup needed
odeimaiz Oct 10, 2025
4968583
work
matusdrobuliak66 Oct 10, 2025
4ab1ac2
work
matusdrobuliak66 Oct 10, 2025
2c58f19
retry functionality
matusdrobuliak66 Oct 10, 2025
af76e5f
pylint fix
matusdrobuliak66 Oct 10, 2025
c45e448
add test
matusdrobuliak66 Oct 10, 2025
27b9900
add test
matusdrobuliak66 Oct 10, 2025
8f9506f
Merge branch 'master' into reopen-fogbugz-cases
matusdrobuliak66 Oct 10, 2025
0521800
add OAS
matusdrobuliak66 Oct 10, 2025
71d8a8b
Merge branch 'reopen-fogbugz-cases' of github.com:matusdrobuliak66/os…
matusdrobuliak66 Oct 10, 2025
5d21ed6
remove timeout
matusdrobuliak66 Oct 10, 2025
5695693
improve comment
matusdrobuliak66 Oct 10, 2025
7beb271
isReadBy
odeimaiz Oct 10, 2025
a4d3cf5
minor
odeimaiz Oct 10, 2025
d8804e7
review @pcrespov
matusdrobuliak66 Oct 12, 2025
91884da
review @pcrespov
matusdrobuliak66 Oct 12, 2025
a762a27
Merge branch 'master' into reopen-fogbugz-cases
matusdrobuliak66 Oct 12, 2025
eae4e67
Merge branch 'master' into enh/conversation-read
odeimaiz Oct 13, 2025
a9b7594
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 13, 2025
3ded6b1
Merge branch 'reopen-fogbugz-cases' of github.com:matusdrobuliak66/os…
odeimaiz Oct 13, 2025
62e7e5d
minor
odeimaiz Oct 13, 2025
ed1f731
promises first
odeimaiz Oct 13, 2025
f420105
cleanup
odeimaiz Oct 13, 2025
9932bd8
minors
odeimaiz Oct 13, 2025
37b1ab2
final things requered by @odeimaiz
matusdrobuliak66 Oct 13, 2025
931f25c
lastMessageCreatedAt
odeimaiz Oct 13, 2025
c67cb13
Merge branch 'reopen-fogbugz-cases' of github.com:matusdrobuliak66/os…
odeimaiz Oct 13, 2025
87fdf16
minor
odeimaiz Oct 13, 2025
4ff6c20
fetchGroups
odeimaiz Oct 13, 2025
362ba82
changeLastMessageCreatedAt
odeimaiz Oct 13, 2025
0bc29da
avoid duplicated calls
odeimaiz Oct 13, 2025
523e096
fogbugzCaseId
odeimaiz Oct 13, 2025
3419a61
Merge branch 'master' into enh/conversation-read
odeimaiz Oct 13, 2025
6116378
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 13, 2025
cee00e8
minors
odeimaiz Oct 13, 2025
4ceb2d4
fix
odeimaiz Oct 13, 2025
d29ec37
sort messages
odeimaiz Oct 13, 2025
e414013
Merge branch 'master' into enh/conversation-read
odeimaiz Oct 14, 2025
9dc21fb
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 14, 2025
76b1bf6
getLastMessageCreatedAt
odeimaiz Oct 14, 2025
c549b29
mark conversations
odeimaiz Oct 14, 2025
8da400a
refactor
odeimaiz Oct 14, 2025
cc93862
refactor
odeimaiz Oct 14, 2025
b537141
Update services/static-webserver/client/source/class/osparc/data/mode…
odeimaiz Oct 14, 2025
8d97537
minor
odeimaiz Oct 14, 2025
2732bd4
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 14, 2025
5fe4c85
minor fix
odeimaiz Oct 14, 2025
0108863
removeListener
odeimaiz Oct 14, 2025
9604d09
minor
odeimaiz Oct 14, 2025
b0eb57e
rename event
odeimaiz Oct 14, 2025
645a601
Merge branch 'master' into enh/conversation-read
odeimaiz Oct 14, 2025
c91e674
minor
odeimaiz Oct 14, 2025
dc64e12
Merge branch 'enh/conversation-read' of github.com:odeimaiz/osparc-si…
odeimaiz Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ qx.Class.define("osparc.conversation.MessageList", {
if (conversation) {
conversation.addListener("messageAdded", e => {
const data = e.getData();
this.__messageAdded(data);
this._messageAdded(data);
});
conversation.addListener("messageDeleted", e => {
const data = e.getData();
Expand All @@ -120,7 +120,7 @@ qx.Class.define("osparc.conversation.MessageList", {
return;
}

this.getConversation().getMessages().forEach(message => this.__messageAdded(message));
this.getConversation().getMessages().forEach(message => this._messageAdded(message));

loadMoreMessages.show();
loadMoreMessages.setFetching(true);
Expand Down Expand Up @@ -153,7 +153,7 @@ qx.Class.define("osparc.conversation.MessageList", {
);
},

__messageAdded: function(message) {
_messageAdded: function(message) {
// ignore it if it was already there
const existingMessageUI = this.__getMessageUI(message.getMessageId());
if (existingMessageUI) {
Expand All @@ -171,7 +171,7 @@ qx.Class.define("osparc.conversation.MessageList", {
control = new osparc.conversation.NotificationUI(message);
break;
}
if (control) {
if (control && this.getConversation()) {
// insert into the UI at the same position
const insertAt = this.getConversation().getMessageIndex(message.getMessageId());
const messagesContainer = this.getChildControl("messages-container");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ qx.Class.define("osparc.conversation.MessageUI", {
});
},

statics: {
isMyMessage: function(message) {
if (message.getUserGroupId() === osparc.data.model.Message.SYSTEM_MESSAGE_ID) {
return false;
}
return message && osparc.auth.Data.getInstance().getGroupId() === message.getUserGroupId();
}
},

events: {
"messageUpdated": "qx.event.type.Data",
"messageDeleted": "qx.event.type.Data",
Expand All @@ -61,7 +52,7 @@ qx.Class.define("osparc.conversation.MessageUI", {

members: {
_createChildControlImpl: function(id) {
const isMyMessage = this.self().isMyMessage(this.getMessage());
const isMyMessage = osparc.data.model.Message.isMyMessage(this.getMessage());
let control;
switch (id) {
case "avatar":
Expand Down Expand Up @@ -154,7 +145,7 @@ qx.Class.define("osparc.conversation.MessageUI", {

const avatar = this.getChildControl("avatar");
const userName = this.getChildControl("user-name");
if (message.getUserGroupId() === osparc.data.model.Message.SYSTEM_MESSAGE_ID) {
if (osparc.data.model.Message.isSupportMessage(message)) {
userName.setValue("Support");
} else {
osparc.store.Users.getInstance().getUser(message.getUserGroupId())
Expand All @@ -168,7 +159,7 @@ qx.Class.define("osparc.conversation.MessageUI", {
});
}

if (this.self().isMyMessage(message)) {
if (osparc.data.model.Message.isMyMessage(message)) {
const menuButton = this.getChildControl("menu-button");

const menu = new qx.ui.menu.Menu().set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*/

qx.Class.define("osparc.data.model.Conversation", {
type: "abstract",
extend: qx.core.Object,

/**
* @param conversationData {Object} Object containing the serialized Conversation Data
* @param studyId {String} ID of the Study
* */
construct: function(conversationData, studyId) {
construct: function(conversationData) {
this.base(arguments);

this.set({
Expand All @@ -36,17 +36,11 @@ qx.Class.define("osparc.data.model.Conversation", {
type: conversationData.type,
created: new Date(conversationData.created),
modified: new Date(conversationData.modified),
projectId: conversationData.projectUuid || null,
extraContext: conversationData.extraContext || null,
studyId: studyId || null,
lastMessageCreatedAt: conversationData.lastMessageCreatedAt ? new Date(conversationData.lastMessageCreatedAt) : null
});

this.__messages = [];
this.__listenToConversationMessageWS();

if (conversationData.type === "SUPPORT") {
this.__fetchFirstAndLastMessages();
}
},

statics: {
Expand Down Expand Up @@ -76,7 +70,7 @@ qx.Class.define("osparc.data.model.Conversation", {
nullable: false,
init: null,
event: "changeName",
apply: "__applyName",
apply: "_applyName",
},

userGroupId: {
Expand Down Expand Up @@ -111,46 +105,11 @@ qx.Class.define("osparc.data.model.Conversation", {
event: "changeModified",
},

projectId: {
check: "String",
nullable: true,
init: null,
event: "changeProjectId",
},

extraContext: {
check: "Object",
nullable: true,
init: null,
event: "changeExtraContext",
},

nameAlias: {
check: "String",
nullable: false,
init: "",
event: "changeNameAlias",
},

firstMessage: {
check: "osparc.data.model.Message",
nullable: true,
init: null,
event: "changeFirstMessage",
},

lastMessage: {
check: "osparc.data.model.Message",
nullable: true,
init: null,
event: "changeLastMessage",
apply: "__applyLastMessage",
},

studyId: {
check: "String",
lastMessageCreatedAt: {
check: "Date",
nullable: true,
init: null,
event: "changeLastMessageCreatedAt",
},
},

Expand All @@ -161,21 +120,11 @@ qx.Class.define("osparc.data.model.Conversation", {
},

members: {
__fetchingFirstAndLastMessage: null,
__nextRequestParams: null,
__messages: null,

__applyName: function(name) {
if (name && name !== "null") {
this.setNameAlias(name);
}
},

__applyLastMessage: function(lastMessage) {
const name = this.getName();
if (!name || name === "null") {
this.setNameAlias(lastMessage ? lastMessage.getContent() : "");
}
_applyName: function(name) {
return;
},

__listenToConversationMessageWS: function() {
Expand All @@ -191,13 +140,14 @@ qx.Class.define("osparc.data.model.Conversation", {
if (conversationId === this.getConversationId()) {
switch (eventName) {
case this.self().CHANNELS.CONVERSATION_MESSAGE_CREATED:
this.addMessage(messageData);
this._addMessage(messageData);
this.setLastMessageCreatedAt(new Date(messageData.created));
break;
case this.self().CHANNELS.CONVERSATION_MESSAGE_UPDATED:
this.updateMessage(messageData);
this._updateMessage(messageData);
break;
case this.self().CHANNELS.CONVERSATION_MESSAGE_DELETED:
this.deleteMessage(messageData);
this._deleteMessage(messageData);
break;
}
}
Expand All @@ -207,38 +157,6 @@ qx.Class.define("osparc.data.model.Conversation", {
});
},

__fetchFirstAndLastMessages: function() {
if (this.__fetchingFirstAndLastMessage) {
return this.__fetchingFirstAndLastMessage;
}

this.__fetchingFirstAndLastMessage = true;
osparc.store.ConversationsSupport.getInstance().fetchLastMessage(this.getConversationId())
.then(resp => {
const messages = resp["data"];
if (messages.length) {
const lastMessage = new osparc.data.model.Message(messages[0]);
this.setLastMessage(lastMessage);
}
// fetch first message only if there is more than one message
if (resp["_meta"]["total"] === 1) {
const firstMessage = new osparc.data.model.Message(messages[0]);
this.setFirstMessage(firstMessage);
} else if (resp["_meta"]["total"] > 1) {
osparc.store.ConversationsSupport.getInstance().fetchFirstMessage(this.getConversationId(), resp["_meta"])
.then(firstMessages => {
if (firstMessages.length) {
const firstMessage = new osparc.data.model.Message(firstMessages[0]);
this.setFirstMessage(firstMessage);
}
});
}
return null;
})
.catch(err => osparc.FlashMessenger.logError(err))
.finally(() => this.__fetchingFirstAndLastMessage = null);
},

amIOwner: function() {
return this.getUserGroupId() === osparc.auth.Data.getInstance().getGroupId();
},
Expand All @@ -251,7 +169,8 @@ qx.Class.define("osparc.data.model.Conversation", {
limit: 42
}
};
if (this.getStudyId()) {
const isProjectConversation = this instanceof osparc.data.model.ConversationProject;
if (isProjectConversation) {
params.url.studyId = this.getStudyId();
}

Expand All @@ -263,13 +182,13 @@ qx.Class.define("osparc.data.model.Conversation", {
const options = {
resolveWResponse: true
};
const promise = this.getStudyId() ?
const promise = isProjectConversation ?
osparc.data.Resources.fetch("conversationsStudies", "getMessagesPage", params, options) :
osparc.data.Resources.fetch("conversationsSupport", "getMessagesPage", params, options);
return promise
.then(resp => {
const messagesData = resp["data"];
messagesData.forEach(messageData => this.addMessage(messageData));
messagesData.forEach(messageData => this._addMessage(messageData));
this.__nextRequestParams = resp["_links"]["next"];
return resp;
})
Expand All @@ -282,13 +201,6 @@ qx.Class.define("osparc.data.model.Conversation", {
.catch(err => osparc.FlashMessenger.logError(err));
},

patchExtraContext: function(extraContext) {
osparc.store.ConversationsSupport.getInstance().patchExtraContext(this.getConversationId(), extraContext)
.then(() => {
this.setExtraContext(extraContext);
});
},

getMessages: function() {
return this.__messages;
},
Expand All @@ -301,81 +213,35 @@ qx.Class.define("osparc.data.model.Conversation", {
return this.__messages.some(msg => msg.getMessageId() === messageId);
},

addMessage: function(messageData) {
_addMessage: function(messageData) {
let message = this.__messages.find(msg => msg.getMessageId() === messageData["messageId"]);
if (!message) {
message = new osparc.data.model.Message(messageData);
this.__messages.push(message);
osparc.data.model.Message.sortMessagesByDate(this.__messages);
this.fireDataEvent("messageAdded", message);
this.__evalFirstAndLastMessage();
}
return message;
},

updateMessage: function(messageData) {
_updateMessage: function(messageData) {
if (messageData) {
const found = this.__messages.find(msg => msg.getMessageId() === messageData["messageId"]);
if (found) {
found.setData(messageData);
this.fireDataEvent("messageUpdated", found);
this.__evalFirstAndLastMessage();
}
}
},

deleteMessage: function(messageData) {
_deleteMessage: function(messageData) {
if (messageData) {
const found = this.__messages.find(msg => msg.getMessageId() === messageData["messageId"]);
if (found) {
this.__messages.splice(this.__messages.indexOf(found), 1);
this.fireDataEvent("messageDeleted", found);
this.__evalFirstAndLastMessage();
}
}
},

__evalFirstAndLastMessage: function() {
if (this.__messages && this.__messages.length) {
// newest first
this.setFirstMessage(this.__messages[this.__messages.length - 1]);
this.setLastMessage(this.__messages[0]);
}
},

getContextProjectId: function() {
if (this.getExtraContext() && "projectId" in this.getExtraContext()) {
return this.getExtraContext()["projectId"];
}
return null;
},

getFogbugzLink: function() {
if (this.getExtraContext() && "fogbugz_case_url" in this.getExtraContext()) {
return this.getExtraContext()["fogbugz_case_url"];
}
return null;
},

getAppointment: function() {
if (this.getExtraContext() && "appointment" in this.getExtraContext()) {
return this.getExtraContext()["appointment"];
}
return null;
},

setAppointment: function(appointment) {
const extraContext = this.getExtraContext() || {};
extraContext["appointment"] = appointment ? appointment.toISOString() : null;
// OM: Supporters are not allowed to patch the conversation metadata yet
const backendAllowsPatch = osparc.store.Groups.getInstance().amIASupportUser() ? false : true;
if (backendAllowsPatch) {
return osparc.store.ConversationsSupport.getInstance().patchExtraContext(this.getConversationId(), extraContext)
.then(() => {
this.setExtraContext(Object.assign({}, extraContext));
});
}
return Promise.resolve(this.setExtraContext(Object.assign({}, extraContext)));
},
},
});
Loading
Loading