This commit is contained in:
marlon-erler
2026-09-23 00:40:03 +02:00
parent f0087cf1cf
commit 66448c6152
4 changed files with 16 additions and 6 deletions
+15 -5
View File
@@ -1298,7 +1298,7 @@
this.connectionModel = connectionModel2; this.connectionModel = connectionModel2;
this.chatListModel = chatListModel2; this.chatListModel = chatListModel2;
this.fileTransferModel = fileTransferModel2; this.fileTransferModel = fileTransferModel2;
this.BUILD = "Build 26.09.22.C"; this.BUILD = "Build 26.09.22.D";
// CONTEXT // CONTEXT
this.contextStack = /* @__PURE__ */ new Map(); this.contextStack = /* @__PURE__ */ new Map();
this.closeContext = (contextId, fromHistoryEvent = false) => { this.closeContext = (contextId, fromHistoryEvent = false) => {
@@ -4666,7 +4666,7 @@
}; };
// src/ViewModel/Global/notificationViewModel.ts // src/ViewModel/Global/notificationViewModel.ts
var NotificationViewModel = class _NotificationViewModel { var NotificationViewModel = class {
// init // init
constructor(chatListViewModel2) { constructor(chatListViewModel2) {
this.chatListViewModel = chatListViewModel2; this.chatListViewModel = chatListViewModel2;
@@ -4678,9 +4678,9 @@
this.interval = void 0; this.interval = void 0;
// main // main
this.showNotification = (message) => { this.showNotification = (message) => {
const notification = _NotificationViewModel.createNotification(message);
if (this.seenMessageIds.has(message.id)) return; if (this.seenMessageIds.has(message.id)) return;
if (this.chatListViewModel.selectedChat.value == void 0) return; if (this.chatListViewModel.selectedChat.value == void 0) return;
const notification = this.createNotification(message);
const currentChat = this.chatListViewModel.selectedChat.value.chatModel.unwrappedPrimaryChannel; const currentChat = this.chatListViewModel.selectedChat.value.chatModel.unwrappedPrimaryChannel;
const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value; const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value;
if (notification.chat == currentChat && currentPage == "messages" /* Messages */) if (notification.chat == currentChat && currentPage == "messages" /* Messages */)
@@ -4728,10 +4728,12 @@
}; };
} }
// util // util
static createNotification(message) { createNotification(message) {
const fullChannel = ChatModel.splitChannel(message.channel)[0];
const chat = this.chatListViewModel.stripNamespace(fullChannel);
return { return {
messageId: message.id, messageId: message.id,
chat: ChatModel.splitChannel(message.channel)[0], chat,
sender: message.sender, sender: message.sender,
body: message.body body: message.body
}; };
@@ -4810,6 +4812,14 @@
} }
this.updateIndices(); 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.notificationViewModel = new NotificationViewModel(this);
this.loadChats(); this.loadChats();
} }
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -9,7 +9,7 @@ import ConnectionModel from "../../Model/Global/connectionModel";
import ChatListModel from "../../Model/Chat/chatListModel"; import ChatListModel from "../../Model/Chat/chatListModel";
export default class CoreViewModel { export default class CoreViewModel {
readonly BUILD = "Build 26.09.22.C"; readonly BUILD = "Build 26.09.22.D";
translations: Translations; translations: Translations;