fix: drop Marmot chatroom on leave so messages clear from caches
When the local user leaves a Marmot MLS group, MarmotManager already wipes MLS state, the relay subscription and the persisted message log, but the chatroom (and its decrypted inner messages) lingered in marmotGroupList until the UI happened to call removeGroup. The CLI leave path skipped that step entirely, and removeGroup itself only dropped the chatroom from rooms — it left noteToGroupIndex entries and the chatroom's own messages set in place, so notes stayed strongly referenced and kept appearing in the Notification feed. Move the in-memory cleanup into Account.leaveMarmotGroup, and have MarmotGroupList.removeGroup also clear the chatroom's messages and the note→group index. LocalCache holds notes weakly, so cutting the strong refs is enough — GC reclaims them and the existing acceptableEvent filter (which keys off marmotGroupList.rooms) hides anything still in-flight.
This commit is contained in:
@@ -2319,6 +2319,12 @@ class Account(
|
||||
}
|
||||
|
||||
val outbound = manager.leaveGroup(nostrGroupId)
|
||||
// manager.leaveGroup already wiped MLS state, relay subscriptions and
|
||||
// the persisted message log. Drop the in-memory chatroom too — that
|
||||
// releases the strong refs to the decrypted inner notes so LocalCache
|
||||
// (which holds them weakly) can GC them, and the Notification feed
|
||||
// (which iterates marmotGroupList.rooms) stops surfacing the group.
|
||||
marmotGroupList.removeGroup(nostrGroupId)
|
||||
client.publish(outbound.signedEvent, groupRelays)
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -316,7 +316,6 @@ fun MarmotGroupInfoScreen(
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
accountViewModel.leaveMarmotGroup(nostrGroupId)
|
||||
accountViewModel.account.marmotGroupList.removeGroup(nostrGroupId)
|
||||
nav.nav(Route.Message)
|
||||
} catch (e: Exception) {
|
||||
isLeaving = false
|
||||
|
||||
Reference in New Issue
Block a user