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,
|
||||
groupRelays: Set<NormalizedRelayUrl>,
|
||||
) {
|
||||
val manager = marmotManager ?: return
|
||||
if (!isWriteable()) return
|
||||
Log.d("MarmotDbg") {
|
||||
"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)
|
||||
Log.d("MarmotDbg") {
|
||||
"removeMarmotGroupMember: built commit kind=${outbound.signedEvent.kind} id=${outbound.signedEvent.id.take(8)}…"
|
||||
}
|
||||
val chatroom = marmotGroupList.getOrCreateGroup(nostrGroupId)
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user