mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 01:42:27 +00:00
fix: apply block/mute list filtering to DM messages and conversations
The user's block/mute list (NIP-51) was not being checked when processing direct messages, allowing blocked users' messages to appear in conversations, trigger notifications, and increment unseen counts. This adds block filtering at four layers: - nostrService.applyDirectMessage: drops incoming DMs from blocked users before they enter the in-memory message cache - nostrService.persistDirectMessageRecord: prevents blocked DM senders from being persisted to IndexedDB or triggering notifications - profileModalController.buildDmConversationData: filters blocked users from the conversation list UI (catches pre-block persisted messages) - applicationBootstrap: excludes blocked-user conversations from the unread DM badge count The block checker is injected via setDmBlockChecker() to keep nostrService decoupled from userBlocks, wired up in app.js init(). https://claude.ai/code/session_01EAVLtAM14GN99Eik8otLg2
This commit is contained in:
5 files changed
+246
-1
No files matched your search
@@ -4197,7 +4197,15 @@ export class ProfileModalController {
|
||||
};
|
||||
}
|
||||
|
||||
const threads = this.groupDirectMessages(messages, actor);
|
||||
const allThreads = this.groupDirectMessages(messages, actor);
|
||||
const blocksService = this.services.userBlocks;
|
||||
const isRemoteBlocked =
|
||||
blocksService && typeof blocksService.isBlocked === "function"
|
||||
? (pubkey) => blocksService.isBlocked(pubkey)
|
||||
: () => false;
|
||||
const threads = allThreads.filter(
|
||||
(thread) => !thread.remoteHex || !isRemoteBlocked(thread.remoteHex),
|
||||
);
|
||||
const remoteKeys = new Set();
|
||||
threads.forEach((thread) => {
|
||||
if (thread.remoteHex) {
|
||||
|
||||
Reference in new issue
Block a user