do not show notifications for own messages

This commit is contained in:
marlon-erler
2026-09-28 16:06:51 +02:00
parent 22acf7f7d8
commit 4a6c0a20b5
6 changed files with 21 additions and 10 deletions
+14 -6
View File
@@ -2410,8 +2410,7 @@
this.updateContact(...contact); this.updateContact(...contact);
}; };
this.unwrapContact = (id, knownName) => { this.unwrapContact = (id, knownName) => {
if (this.contacts.has(id)) if (this.contacts.has(id)) return this.contacts.get(id);
return this.contacts.get(id);
return this.updateContact(id, knownName); return this.updateContact(id, knownName);
}; };
// load // load
@@ -2423,7 +2422,10 @@
} }
}; };
this.loadData(); this.loadData();
this.contactListModel.contactHandlerManager.setHandler("contact-list-view-model", this.handleContact); this.contactListModel.contactHandlerManager.setHandler(
"contact-list-view-model",
this.handleContact
);
} }
}; };
var ContactViewModel = class { var ContactViewModel = class {
@@ -2986,6 +2988,7 @@
chatMessage.status = "received" /* Received */; chatMessage.status = "received" /* Received */;
this.addMessage(chatMessage); this.addMessage(chatMessage);
if (chatMessage.stringifiedFile) return; if (chatMessage.stringifiedFile) return;
if (chatMessage.senderId == this.settingsModel.userid) return;
this.setReadStatus(true); this.setReadStatus(true);
}; };
this.handleReaction = (reaction) => { this.handleReaction = (reaction) => {
@@ -4749,7 +4752,10 @@
}; };
// view // view
this.showChatMessage = (chatMessage) => { this.showChatMessage = (chatMessage) => {
const contact = this.contactListViewModel.unwrapContact(chatMessage.senderId, chatMessage.senderName); const contact = this.contactListViewModel.unwrapContact(
chatMessage.senderId,
chatMessage.senderName
);
const chatMessageViewModel = new ChatMessageViewModel( const chatMessageViewModel = new ChatMessageViewModel(
this.coreViewModel, this.coreViewModel,
this, this,
@@ -5017,8 +5023,9 @@
// src/ViewModel/Global/notificationViewModel.ts // src/ViewModel/Global/notificationViewModel.ts
var NotificationViewModel = class { var NotificationViewModel = class {
// init // init
constructor(chatListViewModel2) { constructor(chatListViewModel2, settingsViewModel2) {
this.chatListViewModel = chatListViewModel2; this.chatListViewModel = chatListViewModel2;
this.settingsViewModel = settingsViewModel2;
// data // data
this.seenMessageIds = /* @__PURE__ */ new Set(); this.seenMessageIds = /* @__PURE__ */ new Set();
this.messagesInMarquee = []; this.messagesInMarquee = [];
@@ -5029,6 +5036,7 @@
this.showNotification = (message) => { this.showNotification = (message) => {
if (this.seenMessageIds.has(message.fileId)) return; if (this.seenMessageIds.has(message.fileId)) return;
if (this.chatListViewModel.selectedChat.value == void 0) return; if (this.chatListViewModel.selectedChat.value == void 0) return;
if (message.senderId == this.settingsViewModel.settingsModel.userid) return;
const notification = this.createNotification(message); const notification = this.createNotification(message);
const currentChat = this.chatListViewModel.selectedChat.value.chatModel.id; const currentChat = this.chatListViewModel.selectedChat.value.chatModel.id;
const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value; const currentPage = this.chatListViewModel.selectedChat.value.selectedPage.value;
@@ -5170,7 +5178,7 @@
} }
return fullChannel; return fullChannel;
}; };
this.notificationViewModel = new NotificationViewModel(this); this.notificationViewModel = new NotificationViewModel(this, this.settingsViewModel);
this.loadChats(); this.loadChats();
} }
}; };
Vendored
+1 -1
View File
@@ -1,4 +1,4 @@
const VERSION = "2610 Beta 16" const VERSION = "2610 Beta 17"
function processUrl(event) { function processUrl(event) {
const url = event.request.url; const url = event.request.url;
+1 -1
View File
@@ -1 +1 @@
2610 Beta 16 2610 Beta 17
+1
View File
@@ -111,6 +111,7 @@ export default class ChatModel {
this.addMessage(chatMessage); this.addMessage(chatMessage);
if (chatMessage.stringifiedFile) return; if (chatMessage.stringifiedFile) return;
if (chatMessage.senderId == this.settingsModel.userid) return;
this.setReadStatus(true); this.setReadStatus(true);
}; };
+1 -1
View File
@@ -101,7 +101,7 @@ export default class ChatListViewModel {
public readonly connectionViewModel: ConnectionViewModel, public readonly connectionViewModel: ConnectionViewModel,
public readonly contactListViewModel: ContactListViewModel, public readonly contactListViewModel: ContactListViewModel,
) { ) {
this.notificationViewModel = new NotificationViewModel(this); this.notificationViewModel = new NotificationViewModel(this, this.settingsViewModel);
this.loadChats(); this.loadChats();
} }
@@ -2,6 +2,7 @@ import { ChatPageTypes } from "../Chat/chatViewModel";
import ChatListViewModel from "../Chat/chatListViewModel"; import ChatListViewModel from "../Chat/chatListViewModel";
import * as React from "../../react"; import * as React from "../../react";
import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel"; import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel";
import SettingsViewModel from "./settingsViewModel";
export default class NotificationViewModel { export default class NotificationViewModel {
// data // data
@@ -15,6 +16,7 @@ export default class NotificationViewModel {
showNotification = (message: ChatMessage): void => { showNotification = (message: ChatMessage): void => {
if (this.seenMessageIds.has(message.fileId)) return; if (this.seenMessageIds.has(message.fileId)) return;
if (this.chatListViewModel.selectedChat.value == undefined) return; if (this.chatListViewModel.selectedChat.value == undefined) return;
if (message.senderId == this.settingsViewModel.settingsModel.userid) return;
const notification: Notification = this.createNotification(message); const notification: Notification = this.createNotification(message);
const currentChat = const currentChat =
@@ -77,7 +79,7 @@ export default class NotificationViewModel {
}; };
// init // init
constructor(public chatListViewModel: ChatListViewModel) {} constructor(public chatListViewModel: ChatListViewModel, public settingsViewModel: SettingsViewModel) {}
// util // util
createNotification(message: ChatMessage): Notification { createNotification(message: ChatMessage): Notification {