feat: a subgroup certified as #name is shown as &name (group-name-prefix, Phase 4)

The parent's subgroup list and the TYPE_SUBGROUP_CERTIFIED line read the
certificate's name through MarmotGroupName.of, so a certificate signed before
the change matches the room it names. The proposal summary stays verbatim:
it shows what the signer is about to approve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-23 02:09:21 +02:00
1 parent 3f54640227
commit 342127bc20
5 files changed
+90 -5

No files matched your search

@@ -40,6 +40,7 @@ import mobi.giza.compose.extensions.toHex
import mobi.giza.compose.managers.ChronicleManager
import mobi.giza.compose.managers.GroupKeyStateManager
import mobi.giza.compose.managers.SubgroupManager
import mobi.giza.compose.managers.MarmotGroupName
import mobi.giza.compose.nostr.MarmotDirectMessage
import mobi.giza.compose.nostr.chronicle.ChronicleEvent
import mobi.giza.compose.nostr.chronicle.ChronicleRequestEvent
@@ -1416,7 +1417,9 @@ data class ChatMessage(
// The name is the one the parent certified, which is the only one
// that was ever put to this room -- the child may since have been
// renamed, and this line is a record of what was agreed rather
// than a view of what is.
// than a view of what is. It is written under today's mark,
// though: a certificate signed as `#name` before
// docs/group-name-prefix.md certified the name, not the `#`.
SubgroupBirthCertificateEvent.KIND -> {
SubgroupManager.record(
database = database,
@@ -1424,7 +1427,7 @@ data class ChatMessage(
innerEvent = event
) ?: return null
val name = SubgroupBirthCertificateEvent.parseName(event.tags)
val name = SubgroupBirthCertificateEvent.parseName(event.tags)?.let(MarmotGroupName::of)
val admins = SubgroupBirthCertificateEvent.parseAdminPublicKeys(event.tags).size
ChatMessage(
@@ -444,7 +444,11 @@ object SubgroupManager {
chatRoomId = chatRoomId,
parentChatRoomId = parentChatRoomId,
certificate = signed,
name = SubgroupBirthCertificateEvent.parseName(event.tags),
// Under today's mark: a certificate signed before
// docs/group-name-prefix.md says `#name`, and the room it
// names is `&name` on this device. What was agreed is the
// name, not the punctuation.
name = SubgroupBirthCertificateEvent.parseName(event.tags)?.let(MarmotGroupName::of),
adminPublicKeys = SubgroupBirthCertificateEvent.parseAdminPublicKeys(event.tags),
room = database.chatRoomDao().findChatRoomById(chatRoomId),
keyState = database.groupKeyStateDao().getByChatRoomId(chatRoomId),
@@ -69,6 +69,11 @@ object ProposedEvent {
SubgroupBirthCertificateEvent.KIND -> Summary(
label = "A new subgroup of this group",
detail = listOfNotNull(
// Verbatim, not through `MarmotGroupName.of`: this is what the
// signer is about to approve, and a certificate proposed before
// docs/group-name-prefix.md says `#name`. The summary of a
// signature shows the bytes being signed, even where the rest
// of the app would show the name under today's mark (D5).
SubgroupBirthCertificateEvent.parseName(event.tags),
SubgroupBirthCertificateEvent.parseAdminPublicKeys(event.tags)
.size