diff --git a/dist/index.js b/dist/index.js index 1d8ea4ed..65303970 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1298,7 +1298,7 @@ this.connectionModel = connectionModel2; this.chatListModel = chatListModel2; this.fileTransferModel = fileTransferModel2; - this.BUILD = "Build 26.09.22.C"; + this.BUILD = "Build 26.09.22.D"; // CONTEXT this.contextStack = /* @__PURE__ */ new Map(); this.closeContext = (contextId, fromHistoryEvent = false) => { @@ -4666,7 +4666,7 @@ }; // src/ViewModel/Global/notificationViewModel.ts - var NotificationViewModel = class _NotificationViewModel { + var NotificationViewModel = class { // init constructor(chatListViewModel2) { this.chatListViewModel = chatListViewModel2; @@ -4678,9 +4678,9 @@ this.interval = void 0; // main this.showNotification = (message) => { - const notification = _NotificationViewModel.createNotification(message); if (this.seenMessageIds.has(message.id)) return; if (this.chatListViewModel.selectedChat.value == void 0) return; + const notification = this.createNotification(message); const currentChat = this.chatListViewModel.selectedChat.value.chatModel.unwrappedPrimaryChannel; const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value; if (notification.chat == currentChat && currentPage == "messages" /* Messages */) @@ -4728,10 +4728,12 @@ }; } // util - static createNotification(message) { + createNotification(message) { + const fullChannel = ChatModel.splitChannel(message.channel)[0]; + const chat = this.chatListViewModel.stripNamespace(fullChannel); return { messageId: message.id, - chat: ChatModel.splitChannel(message.channel)[0], + chat, sender: message.sender, body: message.body }; @@ -4810,6 +4812,14 @@ } this.updateIndices(); }; + // utility + this.stripNamespace = (fullChannel) => { + for (const vm of this.chatViewModels.value) { + const fullReference = vm.chatModel.info.namespace + vm.chatModel.info.primaryChannel; + if (fullReference == fullChannel) return vm.chatModel.info.primaryChannel; + } + return fullChannel; + }; this.notificationViewModel = new NotificationViewModel(this); this.loadChats(); } diff --git a/src/ViewModel/Global/.coreViewModel.ts.swp b/src/ViewModel/Global/.coreViewModel.ts.swp new file mode 100644 index 00000000..812005ee Binary files /dev/null and b/src/ViewModel/Global/.coreViewModel.ts.swp differ diff --git a/src/ViewModel/Global/.notificationViewModel.ts.swp b/src/ViewModel/Global/.notificationViewModel.ts.swp deleted file mode 100644 index 80eeaedd..00000000 Binary files a/src/ViewModel/Global/.notificationViewModel.ts.swp and /dev/null differ diff --git a/src/ViewModel/Global/coreViewModel.ts b/src/ViewModel/Global/coreViewModel.ts index 6c50ff2b..d75f1358 100644 --- a/src/ViewModel/Global/coreViewModel.ts +++ b/src/ViewModel/Global/coreViewModel.ts @@ -9,7 +9,7 @@ import ConnectionModel from "../../Model/Global/connectionModel"; import ChatListModel from "../../Model/Chat/chatListModel"; export default class CoreViewModel { - readonly BUILD = "Build 26.09.22.C"; + readonly BUILD = "Build 26.09.22.D"; translations: Translations;