Skip to content

Commit 76b1bf6

Browse files
committed
getLastMessageCreatedAt
1 parent 9dc21fb commit 76b1bf6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ qx.Class.define("osparc.data.model.Conversation", {
3636
type: conversationData.type,
3737
created: new Date(conversationData.created),
3838
modified: new Date(conversationData.modified),
39-
lastMessageCreatedAt: conversationData.last_message_created_at ? new Date(conversationData.last_message_created_at) : null
39+
lastMessageCreatedAt: conversationData.lastMessageCreatedAt ? new Date(conversationData.lastMessageCreatedAt) : null
4040
});
4141

4242
this.__messages = [];

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ qx.Class.define("osparc.data.model.ConversationSupport", {
184184
addMessage: function(messageData) {
185185
const message = this.base(arguments, messageData);
186186
this.__evalFirstAndLastMessage();
187+
// mark conversation as unread if the message is from the other party
188+
const userGroupId = message.getUserGroupId();
189+
const myGroupId = osparc.auth.Data.getInstance().getGroupId();
190+
if (userGroupId !== myGroupId) {
191+
if (osparc.store.Groups.getInstance().amIASupportUser()) {
192+
this.setReadBySupport(false);
193+
} else {
194+
this.setReadByUser(false);
195+
}
196+
}
187197
return message;
188198
},
189199

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ qx.Class.define("osparc.support.ConversationListItem", {
140140
__populateWithLastMessage: function() {
141141
const conversation = this.getConversation();
142142
this.set({
143-
role: osparc.utils.Utils.formatDateAndTime(conversation.getModified()),
143+
role: osparc.utils.Utils.formatDateAndTime(conversation.getLastMessageCreatedAt()),
144144
});
145145
const lastMessage = conversation.getLastMessage();
146146
if (lastMessage) {

0 commit comments

Comments
 (0)