fix highlight of unread messages
This commit is contained in:
@@ -84,9 +84,8 @@ export default class ChatModel {
|
||||
|
||||
chatMessage.status = ChatMessageStatus.Received;
|
||||
this.addMessage(chatMessage);
|
||||
|
||||
this.info.hasUnreadMessages = true;
|
||||
this.storeInfo();
|
||||
|
||||
this.setReadStatus(true);
|
||||
};
|
||||
|
||||
handleMessageSent = (chatMessage: ChatMessage): void => {
|
||||
@@ -177,8 +176,8 @@ export default class ChatModel {
|
||||
this.connectionModel.addChannel(this.info.primaryChannel);
|
||||
};
|
||||
|
||||
markRead = (): void => {
|
||||
this.info.hasUnreadMessages = false;
|
||||
setReadStatus = (hasUnreadMessages: boolean): void => {
|
||||
this.info.hasUnreadMessages = hasUnreadMessages;
|
||||
this.storeInfo();
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user