Merge pull request #2524 from vitorpamplona/claude/fix-marmot-chat-filter-cDP3C
Fix Marmot group message filtering for multi-account scenarios
This commit is contained in:
+14
-3
@@ -176,9 +176,20 @@ class NotificationFeedFilter(
|
|||||||
): Boolean {
|
): Boolean {
|
||||||
val loggedInUserHex = account.userProfile().pubkeyHex
|
val loggedInUserHex = account.userProfile().pubkeyHex
|
||||||
|
|
||||||
// Marmot group messages are always acceptable (user is a group member)
|
// Marmot group messages are only acceptable if the gathering chatroom is
|
||||||
val isMarmotGroupMessage = it.inGatherers?.any { g -> g is MarmotGroupChatroom } == true
|
// actually in the current account's group list. Notes are stored in the
|
||||||
if (isMarmotGroupMessage) {
|
// global LocalCache and accumulate a gatherer reference from every
|
||||||
|
// account's chatroom that has ever touched them, so seeing any
|
||||||
|
// MarmotGroupChatroom is not enough — it could belong to a prior account
|
||||||
|
// or a group the user has since left. Verify the chatroom is the same
|
||||||
|
// instance held by this account's list.
|
||||||
|
val marmotGatherers = it.inGatherers?.filterIsInstance<MarmotGroupChatroom>()
|
||||||
|
if (!marmotGatherers.isNullOrEmpty()) {
|
||||||
|
val inCurrentAccount =
|
||||||
|
marmotGatherers.any { room ->
|
||||||
|
account.marmotGroupList.rooms.get(room.nostrGroupId) === room
|
||||||
|
}
|
||||||
|
if (!inCurrentAccount) return false
|
||||||
return it.author?.pubkeyHex != loggedInUserHex
|
return it.author?.pubkeyHex != loggedInUserHex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user