debug(marmot): log removeMarmotGroupMember + syncMetadataTo transitions
The bug report: after tapping Remove on the Marmot Group Info screen, the target npub stays in the member list, and the only log line is the round-tripped kind:445 hitting the "Duplicate" branch in GroupEventHandler.add. The author-side path (Account.removeMarmotGroupMember → MarmotManager.removeMember → syncMetadataTo → publish) has no logging, so there's no way to tell which step broke — the MLS tree mutation, the local member-list push to chatroom.members, or the UI recomposition. Mirror the addMarmotGroupMember logging style on removeMarmotGroupMember (entry, no-op guards, built commit id, publish) so we can see whether the author path even runs end-to-end, and have syncMetadataTo log the group id and the previous→new member count so the StateFlow update becomes observable. No behavior change.
This commit is contained in:
@@ -2313,12 +2313,30 @@ class Account(
|
|||||||
targetLeafIndex: Int,
|
targetLeafIndex: Int,
|
||||||
groupRelays: Set<NormalizedRelayUrl>,
|
groupRelays: Set<NormalizedRelayUrl>,
|
||||||
) {
|
) {
|
||||||
val manager = marmotManager ?: return
|
Log.d("MarmotDbg") {
|
||||||
if (!isWriteable()) return
|
"removeMarmotGroupMember: group=${nostrGroupId.take(8)}… targetLeafIndex=$targetLeafIndex " +
|
||||||
|
"groupRelays=${groupRelays.size}"
|
||||||
|
}
|
||||||
|
val manager =
|
||||||
|
marmotManager ?: run {
|
||||||
|
Log.w("MarmotDbg") { "removeMarmotGroupMember: marmotManager is NULL — no-op" }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!isWriteable()) {
|
||||||
|
Log.w("MarmotDbg") { "removeMarmotGroupMember: account is not writeable — no-op" }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val outbound = manager.removeMember(nostrGroupId, targetLeafIndex)
|
val outbound = manager.removeMember(nostrGroupId, targetLeafIndex)
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"removeMarmotGroupMember: built commit kind=${outbound.signedEvent.kind} id=${outbound.signedEvent.id.take(8)}…"
|
||||||
|
}
|
||||||
val chatroom = marmotGroupList.getOrCreateGroup(nostrGroupId)
|
val chatroom = marmotGroupList.getOrCreateGroup(nostrGroupId)
|
||||||
manager.syncMetadataTo(nostrGroupId, chatroom)
|
manager.syncMetadataTo(nostrGroupId, chatroom)
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"removeMarmotGroupMember: publishing commit id=${outbound.signedEvent.id.take(8)}… " +
|
||||||
|
"to ${groupRelays.size} relay(s): ${groupRelays.map { it.url }}"
|
||||||
|
}
|
||||||
client.publish(outbound.signedEvent, groupRelays)
|
client.publish(outbound.signedEvent, groupRelays)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -566,9 +566,14 @@ class MarmotManager(
|
|||||||
chatroom.adminPubkeys.value = metadata.adminPubkeys
|
chatroom.adminPubkeys.value = metadata.adminPubkeys
|
||||||
chatroom.relays.value = metadata.relays
|
chatroom.relays.value = metadata.relays
|
||||||
}
|
}
|
||||||
|
val previousCount = chatroom.members.value.size
|
||||||
val members = memberPubkeys(nostrGroupId)
|
val members = memberPubkeys(nostrGroupId)
|
||||||
chatroom.members.value = members
|
chatroom.members.value = members
|
||||||
chatroom.memberCount.value = members.size
|
chatroom.memberCount.value = members.size
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"syncMetadataTo: group=${nostrGroupId.take(8)}… members $previousCount→${members.size} " +
|
||||||
|
"(leafs=${members.map { it.leafIndex }})"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user