fix highlight of unread messages

This commit is contained in:
marlon-erler
2026-04-01 14:16:38 +00:00
parent 76a4905936
commit 8a997aab24
3 changed files with 36 additions and 34 deletions
+16 -10
View File
@@ -46,14 +46,14 @@ export default class ChatViewModel {
// view
open = (): void => {
this.chatListViewModel.openChat(this);
this.markRead();
this.setReadStatus(false);
};
close = (): void => {
this.chatListViewModel.closeChat();
};
closeSubPages = (): void => {};
closeSubPages = (): void => { };
setColor = (color: Color): void => {
this.setDisplayedColor(color);
@@ -74,11 +74,6 @@ export default class ChatViewModel {
this.index.value = index;
};
markRead = (): void => {
this.hasUnreadMessages.value = false;
this.chatModel.markRead();
};
// load
loadPageSelection = (): void => {
const path: string[] = StorageModel.getPath(
@@ -97,14 +92,25 @@ export default class ChatViewModel {
};
loadInfo = (): void => {
this.hasUnreadMessages.value = this.chatModel.info.hasUnreadMessages;
this.updateReadStatus();
this.taskBoardSuggestions.set(CALENDAR_EVENT_BOARD_ID, [
CALENDAR_EVENT_BOARD_ID,
translations.chatPage.calendar.eventsBoard,
]);
};
updateReadStatus = (): void => {
if (this.chatListViewModel.selectedChat.value == this) {
this.chatModel.setReadStatus(false);
}
this.hasUnreadMessages.value = this.chatModel.info.hasUnreadMessages;
}
setReadStatus = (hasUnreadMessages: boolean): void => {
this.chatModel.setReadStatus(hasUnreadMessages);
this.hasUnreadMessages.value = hasUnreadMessages;
}
// init
constructor(
public coreViewModel: CoreViewModel,
@@ -148,7 +154,7 @@ export default class ChatViewModel {
chatModel.chatMessageHandlerManager.addHandler(
(chatMessage: ChatMessage) => {
this.messagePageViewModel.showChatMessage(chatMessage);
this.markRead();
this.updateReadStatus();
},
);